Hi... I have a dialog based MFC application with a button on it that opens a property sheet with four pages. I want to use a variable in the dialog and I want to use the same variable in  the property sheet. So if I have a variable x in the dialog, and I try to use it in the property sheet, I must be able to have the variables value. At the moment I am using the EXTERN definition. Is there another nicer way because I don't like EXTERN. Thanks
Who is Participating?
cyrilbdtConnect With a Mentor Commented:
 CMyPropSheet sheet;
 CPage1 page1;
 page1.m_x = m_x;
 if(sheet.DoModal() != IDOK)
 m_x = page1.m_x;

No disrespect to cyrilbdt, but a slightly slicker method would be to write your pages to accept a pointer or a reference to your variable.  That way the pages can update the variable directly.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.