0

The below code, creating a Property Sheet, works without problem in an Application File.

.......

CProp_Sheet Pr_Sheet(_T("PS"));

CPr_Page_1 Pr_Page_1;
CPr_Page_2 Pr_Page_2;

Pr_Sheet.AddPage(&Pr_Page_1);
Pr_Sheet.AddPage(&Pr_Page_2);

m_pMainWnd = &Pr_Sheet;

int nResponse = Pr_Sheet.DoModal();

However, when I put the same code in a DLL, and call it from a menu item in another Application, m_pMainWnd cannot be used (the menu in the Application is to remain visible behind the Property Sheet).

I have tried to create a handle

CWnd* m_pWnd = &Pr_Sheet;

and use m_pWnd in the CProp_Sheet constructor, but although compiling correctly at run time failure always occurs at

CProp_Sheet::OnInitDialog().

Thanks in advance for any comments.

sergiol
  • 4,122
  • 4
  • 47
  • 81
ZYX
  • 69
  • 1
  • 8
  • 2
    Setting m_pMainWnd is only needed when you have a stand alone dialog base application. Just forget this code line. What is the error you receive? Where do you receive the error? Call Stack? – xMRi May 02 '16 at 07:20
  • The code sample you provided is too vague. For people helping you, they need to know more about what classes CProp_Sheet, CPr_Page_1, CPr_Page_2, and the body of your OnInitDaialog. – sergiol May 06 '16 at 13:26

0 Answers0