I'm trying to create a dialog manually by calling CDialog::Create().
The problem is, CDialog::Create() doesn't recognize my resource ID and it fails to create one.
This is the actual code.
CNeffyDlg dlg;
dlg.Create(IDD_NEFFY_DIALOG);
dlg.ShowWindow(SW_SHOW);
It fails on dlg.Create(IDD_NEFFY_DIALOG). To be detail, debug assertion fails on this method and the process terminates.
I've followed the function calls and this is the abstract call chain. (sorry for the mess)
1. _AFXWIN_INLINE BOOL CDialog::Create(UINT nIDTemplate, CWnd* pParentWnd)
{ return CDialog::Create(ATL_MAKEINTRESOURCE(nIDTemplate), pParentWnd);
2. #ifdef _DEBUG
if (!_AfxCheckDialogTemplate(lpszTemplateName, FALSE))
3. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
{ ASSERT(afxCurrentResourceHandle != NULL);
4. AFX_MODULE_STATE* AFXAPI AfxGetModuleState()
#4 returns and I guess the assertion on #3 fails. I have changed resource.h manually since there were duplicated resource ID values, and I've deleted aps, res file and recompiled it. It didn't help, and I don't know what to do. If anyone has an idea I'd be glad to here them. Thanks in advance.
More information : This is actually based on NPAPI code sample, and since this sample isn't a MFC project, I've added MFC support. Though I could use CString, AfxMessageBox(), the class wizard didn't let me create a MFC dialog class and told me I can't do it because this project isn't a MFC project. So I had to write down a MFC dialog code manually, and I copy&pasted the related code from another MFC dialog-based project.