PropertySheet som Modal dialog
Haves:BOOL CTabMenuApp::InitInstance()
{
....
....
CTabMenuDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK){
....
....
return FALSE;
}
BOOL CTabMenuDlg::OnInitDialog()
{
...
...
// TODO: Add extra initialization here
CTabMenu menu(IDD_DIALOG1);
menu.DoModal();
return TRUE; // return TRUE unless you set the focus to a control
}
Ønskes:
At slippe af med fejlen i denne metode:
CPropertySheet::CPropertySheet(UINT nIDCaption, CWnd* pParentWnd,
UINT iSelectPage)
{
ASSERT(nIDCaption != 0);
====> VERIFY(m_strCaption.LoadString(nIDCaption) != 0);
CommonConstruct(pParentWnd, iSelectPage);
}
Bemærkning:
int nLen = AfxLoadString(nID, szTemp, _countof(szTemp));
Skulle finde Caption for den givne dialog, men det er her det går galt og hvorfor???
For til orientering:
CTabMenu::CTabMenu(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
AddPage(&m_page1);
AddPage(&m_page2);
AddPage(&m_page3);
}