Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3042

Problem with using CDialog from CPropertyPage

$
0
0
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.

Viewing all articles
Browse latest Browse all 3042

Trending Articles