Why Domodal will return -1 in MUI application?
Hi All,
I have added MUI into my application, In my app InitInstance(), I have
called
AfxSetResourceHandle(this->m_muiResource); to set resource handle.
Then, I register my Dialog window class.
Code SnippetCPopupDlg::CPopupDlgl(CWnd* pParent /*=NULL*/)
: CDialog(CPopupDlg::IDD, pParent)
{
HINSTANCE hInst = AfxGetInstanceHandle();
WNDCLASS wc;
if (!::GetClassInfo(hInst, AfxRegisterWndClass(0), &wc))
{
}
wc.lpszClassName = DLG_CLASS_NAME;
wc.cbWndExtra = DLGWINDOWEXTRA ;
wc.lpfnWndProc = DefDlgProc;
wc.hIcon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDR_MAINFRAME));
if (!AfxRegisterClass(&wc))
{
}
}
The GetClassInfo and AfxRegisterClass are successed.
When I Domodal my dialog, It fails, after I Debug and step into. I found
that the CreateDialogIndirect() method returns the error 1407,
(ERROR_CANNOT_FIND_WND_CLASS),
I have tried another way, I removed the CLASS "MY_INST_DIALOG" from .rc
file. and Do not AfxRegisterClass() to register class name for dialog, Then,
Domodal() will work.
It seems Register Class in MUI application has some problem? Does anyone
encounter this same problem?
I also found, If i do not use MUI function, It will be ok, The dialog can
pop up correctly.
Please help to check this and give me your suggestion. Thanks!!!
--
Rejoice,I Desire!