
February 5th, 2006, 01:20 PM
|
|
Contributing User
|
|
Join Date: Mar 2005
Posts: 276
Time spent in forums: 1 Day 11 h 48 m 58 sec
Reputation Power: 4
|
|
Quote: | Originally Posted by SamWormie I'm having a very odd problem with some MFC code. I've created a few subclasses of CDialog, using the build in tools in MFC, and my own code. It was working fine, until one day, although I didn't work the code, it crashes if I send it custom messages. I was able to do so before. I am able to send exactly two custom messages, and then the app crashes, citing an Access Violation Exception. A stack trace on this exception shows that it is rooted in system code, and at no point does it go through my code. Some the crash is happening at some point within the MFC DLL, on a separate thread from mine. THe only thing I've changed is how I'm linking to MFC, and as I said, it was working before. Let me know if anyone can think of anything. I'll provide more info if asked.
Thanks |
As I have not been in touch with MFC for sometime, can rely on my memory.
Ok. one reason can be the order in which you are decalring CDialog class and secondly you have to set the Dialog as True.
thats is CDialog(TRUE) for showing visiblity .
Another reson can be some inclusion of file in wrong order that is <windows.h> coming later than predifined files.
Change the ordering of header files included by you and secondly after creating a class , set it to true.
Then perhaps its like this
CDialog Dig
Dig(TRUE) followed by Dig.Message( ....)
Another way of sending custom message is by using AFXMessage method. For details refer to MSDN.
Hope this helps you.
|