Hi,
I have a problem with a SDI app. What I want to do is to create more than one view for the app. I wrote a CMainFrame member function that creates an extra view in this way:
void CMainFrame::Function()
{
CCreateContext context;
context.m_pNewViewClass = RUNTIME_CLASS(CMyView);
context.m_pCurrentFrame = NULL;
context.m_pLastView = NULL;
context.m_pCurrentDoc = NULL;
context.m_pNewDocTemplate = NULL;
CMyView *pView = STATIC_DOWNCAST(CGimTreeView, CreateView(&context));
... and now I hide the current view and show the new one just created (sending wm_initialupdate to the pointer, ...).
}
The fact is that this code runs ok in Debug mode, and when I launch the app. in Release mode from the vs environment (pressing f5) it also runs, but if I try to launch the app directly from the release folder with a double clic, it fails. I have debugged the release version (attaching the vs environtment to the version compiled in release mode with debug info generation) and found that the app. crashes because the
CMyView *pView = STATIC_DOWNCAST(CGimTreeView, CreateView(&context));
returns NULL (and at the next call to a method of pView it crashes).
Any idea about why I can not create a view in Release mode??
Thanks in advance and sorry for my poor english.
I have a problem with a SDI app. What I want to do is to create more than one view for the app. I wrote a CMainFrame member function that creates an extra view in this way:
void CMainFrame::Function()
{
CCreateContext context;
context.m_pNewViewClass = RUNTIME_CLASS(CMyView);
context.m_pCurrentFrame = NULL;
context.m_pLastView = NULL;
context.m_pCurrentDoc = NULL;
context.m_pNewDocTemplate = NULL;
CMyView *pView = STATIC_DOWNCAST(CGimTreeView, CreateView(&context));
... and now I hide the current view and show the new one just created (sending wm_initialupdate to the pointer, ...).
}
The fact is that this code runs ok in Debug mode, and when I launch the app. in Release mode from the vs environment (pressing f5) it also runs, but if I try to launch the app directly from the release folder with a double clic, it fails. I have debugged the release version (attaching the vs environtment to the version compiled in release mode with debug info generation) and found that the app. crashes because the
CMyView *pView = STATIC_DOWNCAST(CGimTreeView, CreateView(&context));
returns NULL (and at the next call to a method of pView it crashes).
Any idea about why I can not create a view in Release mode??
Thanks in advance and sorry for my poor english.