Re: CString with propertypage
If only one property page needs to access the data I would typically assign
it to a member variable on the page directly from the parent sheet at
runtime. If more than one page needs access to the variable I would store
it in the parent property sheet and have a macro like this in the header of
each of the pages (many times all of my pages are defined in one header file
so this is easily added to one place:
#define GET_PARENT ((CSettingsDialog *)GetParent())
To get the values from the parent with a call like:
CString cs = GET_PARENT->m_csString;
You could also assign it back so other pages would know about the change:
GET_PARENT->m_csString = cs;
I do this assignment in the OnShowWindow() function in the pages. The
downfall of this method is you can't debug it very easily, but you can
always look at the result so it is still possible.
I don't know that this is the most elegant solution, but it has worked well
for me for many years.
Tom
"mido1971" <mido1971@discussions.microsoft.com> wrote in message
news:502994E7-BDA3-4A11-A0ED-BAFBF85EA1FA@microsoft.com...
hi
how can i get string from CPropertySheet
ex.
CMySheet ...
{
CString str = _T("xxx"); // how to send this string to
propertypage 1 or 2
AddPage(&m_PropPage1);
AddPage(&m_PropPage2);
}
or how to allocat it in memory in mysheet and then get it in mypage
thanks for help