Thread: SendMessage causes an exception in release.

  1. #1

    SendMessage causes an exception in release.

    FYI I use VC++ 6 STD and program in MFC.

    I created a Dialog program with AppWizard. Then using ClassWizard a created a class called DSocket derived from CAsyncSocket. In DSocket's header file I defined DSOCK_RECEIVE as WM_APP + 1. Then in I also added a member variable called m_hWnd and the dialog sets it to the dialogs window. In DSocket's vitual function OnRecieve I call SendMessage(m_hWnd,DSOCK_RECIEVE,0,0). Then in my Dialog cpp file I added ON_MESSAGE(DSOCK_RECEIVE,OnSocketReceive) to my message map. However, this causes an exception in Release but not in Debug. It is the SendMessage() that fails for if I comment in out alone there's no exception. I could used alternative methods to do this but I would have to set a timer in my dialog and keep checking but that's not efficient. Any ideas why this fails?

  2. #2
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Tiny problems, uncaught in debug version will arise often in release versions : "Welcome to the real world!" ;)

    Try to check the param count. Is it the required number for the given function?

    Such errors remain hidden in debug versions.

    Have fun!

    Btw, you can debug release version as well! Just check project settings and build the required pdb files.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Exception handling in a large project
    By EVOEx in forum C++ Programming
    Replies: 7
    Last Post: 01-25-2009, 07:33 AM
  2. exception handling
    By coletek in forum C++ Programming
    Replies: 2
    Last Post: 01-12-2009, 05:28 PM
  3. Handle C++ exception and structured exception together
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 01-24-2008, 09:21 PM
  4. Signal and exception handling
    By nts in forum C++ Programming
    Replies: 23
    Last Post: 11-15-2007, 02:36 PM
  5. Problem with the exception class in MINGW
    By indigo0086 in forum C++ Programming
    Replies: 6
    Last Post: 01-20-2007, 01:12 PM