Hi,
I have CPropertySheet which contain multiple CPropertyPage as tabs. In one of the CPropertyPage i have a button and clicking on the button launches a CDialog. i am trying to get the control to CPropertyPage calling GetParent() method inside the CDialog class methods but somehow i don't get the right parent window and when i try to access the members of CPropertypage it throws Access Violation Exception.
Following is the code i have used:
CDialog *parentDialog = (CDialog *)GetParent(); // which return the CDialog as WS_POPUP style is used
CPropertyPage *parentPage = (CPropertyPage *)parentDialog->GetParent(); // trying to get the CPropertyPage from where the dialog is launched.
DResourceStateMgr dSrcStateMgr(parentPage->m_psp.hInstance); // throws Access Violation exception.
Same thing used to work in the Visual studio 2008 but when i moved to visual studio 2013 it throws exception.
I have CPropertySheet which contain multiple CPropertyPage as tabs. In one of the CPropertyPage i have a button and clicking on the button launches a CDialog. i am trying to get the control to CPropertyPage calling GetParent() method inside the CDialog class methods but somehow i don't get the right parent window and when i try to access the members of CPropertypage it throws Access Violation Exception.
Following is the code i have used:
CDialog *parentDialog = (CDialog *)GetParent(); // which return the CDialog as WS_POPUP style is used
CPropertyPage *parentPage = (CPropertyPage *)parentDialog->GetParent(); // trying to get the CPropertyPage from where the dialog is launched.
DResourceStateMgr dSrcStateMgr(parentPage->m_psp.hInstance); // throws Access Violation exception.
Same thing used to work in the Visual studio 2008 but when i moved to visual studio 2013 it throws exception.