i created one dialog based application. In that Dlg App class i am calling RegisterShellFileTypes(), in CWInApp::initInstace.
But application is crashing due to no poniter to document class.
code is like this :
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
// TODO: Place code here to handle when the dialog is// dismissed with OK
elseif (nResponse == IDCANCEL)
// TODO: Place code here to handle when the dialog is// dismissed with Cancel
so, can anyone tell me what is the problem exactly?
The problem is precisely what the error message says. RegisterShellFileTypes creates registry entries to associate a document type and file extension with an .exe. If you aren't using the MFC DocView framework, there is no document class and the function call fails.
You can make the same registry entries manually; just because you aren't using the DocView framework doesn't mean you can't associate a file extension with an app, it just takes a bit more code.
Yeah.... and what does SDI stand for? 'Single Document Interface'. It works in an SDI app because the SDI app has a document class, and fails in your dialog app because it doesn't have a document class.