Archived

This topic is now archived and is closed to further replies.

Independant MFC window

This topic is 5536 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am developping a program using an independant MFC window(setup). But the rest of the application is a Win32 prog. I tried to implement a MFC Dialog based window with Visual C++ to use it in my application using MyWin->DoModal(). But it crashes !!! The problem is that VSC++ creates a global MFC application required, I think, to use the modal window. So, how can I use an independant MFC windows. Thanks.

Share this post


Link to post
Share on other sites
where does it crash?

i''d say it''s possible to have an mfc window without using i.e. CApplication and other mfc stuff, but without more details it''s hard to say what your problem is.

make sure you''re running a debug build.

Share this post


Link to post
Share on other sites
The problem is that when you use VisualC++ to generate a Modal Application, it creates a global application which call the modal box using win.DoModal() in the init function.

I tried to take the .cc and .h of the modal box to import in my application(which is a win32 one). So, I created the win and when I called win.domodal(), it crashed.

Is it some initialisations required by the modal box?

Share this post


Link to post
Share on other sites
The problem is that when you use VisualC++ to generate a Modal Application, it creates a global application which call the modal box using win.DoModal() in the init function.

I tried to take the .cc and .h of the modal box to import in my application(which is a win32 one). So, I created the win and when I called win.domodal(), it crashed.

Is it some initialisations required by the modal box?

Share this post


Link to post
Share on other sites
The problem is that when you use VisualC++ to generate a Modal Application, it creates a global application which call the modal box using win.DoModal() in the init function.

I tried to take the .cc and .h of the modal box to import in my application(which is a win32 one). So, I created the win and when I called win.domodal(), it crashed.

Is it some initialisations required by the modal box?

Share this post


Link to post
Share on other sites
The problem is that when you use VisualC++ to generate a Modal Application, it creates a global application which call the modal box using win.DoModal() in the init function.

I tried to take the .cc and .h of the modal box to import in my application(which is a win32 one). So, I created the win and when I called win.domodal(), it crashed.

Is it some initialisations required by the modal box?

Share this post


Link to post
Share on other sites
Take a look at using the AfxWinInit function before you instantiate your MFC-based dialog. I think it does the required setup. The call syntax is the same as that for WinMain. Here''s the template:

BOOL AFXAPI AfxWinInit( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow );

Hope this helps.

Share this post


Link to post
Share on other sites