Calling CDialog::DoModal crashes 
Author Message
 Calling CDialog::DoModal crashes

I'm writing a game using DirectX. So my application is a normal Win32
application, no MFC application. But I want to use CDialog for the options
dialog, so I added MFC support (added the header files to stdafx.h and
linked the program with MFC).
The problem is that the program always crashes when I call CDialog::DoModal.
I debugged the program and saw that the program failed to call
AfxGetResourceHandle from within DoModal.
Did I make something wrong? How can I make it work?

Tim Kosse



Fri, 21 Mar 2003 03:00:00 GMT  
 Calling CDialog::DoModal crashes
This is happening because you aren't using MFC. Passing hInstance from your
WinMain into ::AfxSetResourceHandle perhaps might do the trick but really if
you want to use MFC classes you should have a MFC application. There is a
lot of thread specific stuff that MFC classes call and this is often
required to be set up in the CWinApp derived class. You don't need the
document / view architecture but deriving your application class from
CWinApp will get rid of a shed load of headaches.


Quote:
> I'm writing a game using DirectX. So my application is a normal Win32
> application, no MFC application. But I want to use CDialog for the options
> dialog, so I added MFC support (added the header files to stdafx.h and
> linked the program with MFC).
> The problem is that the program always crashes when I call
CDialog::DoModal.
> I debugged the program and saw that the program failed to call
> AfxGetResourceHandle from within DoModal.
> Did I make something wrong? How can I make it work?

> Tim Kosse



Fri, 21 Mar 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Q: How to move a CDialog before calling DoModal()

2. Using DoModal from CDialog when called from a DLL

3. CDialog::DoModal(), CDialog::EndDialog() Design Flaw

4. Q: CDialog::DoModal () fails

5. CDialog::DoModal

6. CDialog.DoModal problem

7. Help. CDialog::DoModal Fail in _beginthreadex

8. CDialog::DoModal() Behaviour

9. Invalid Page Fault from CDialog.DoModal()

10. CDialog::DoModal()

11. CDialog::DoModal() keyboard messages?????

12. HELP! CDialog/DoModal problems in regular DLL

 

 
Powered by phpBB® Forum Software