C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 5th, 2006, 02:43 AM
SamWormie SamWormie is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Posts: 1 SamWormie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 57 sec
Reputation Power: 0
Windows MFC Message Crashes

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

Reply With Quote
  #2  
Old February 5th, 2006, 01:20 PM
Cirus Cirus is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 276 Cirus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Windows MFC Message Crashes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT