Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange MFC problem (unable to create extra view)

Status
Not open for further replies.

epaez

Programmer
Jun 22, 2006
1
ES
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top