Click to See Complete Forum and Search --> : CWinThread and ON_THREAD_MESSAGE


Jeremy Prowse
May 13th, 1999, 10:39 AM
I have a multi-threaded application that I have been careful to keep thread-safe. Everything works fine in Debug mode (naturally), but when I switch to Release mode, I get a GPF. In my derived CWinThread object, I manually entered ON_THREAD_MESSAGE(TM_DO_ACTION, OnDoAction) and I have defined TM_DO_ACTION to be (WM_APP + 1). I naturally added the prototype, manually, in the class definition under the AFX_MSG message map section.

Now, when I comment the CWinThread's message map for the thread message out, there is no GPF. When I remove the comments and respond to the message (int i; i = 7;) the program crashes with the standard GPF. Why would a program crash simply because I am adding a message map function to respond to a custom thread message?