Executing message handler function crashes app. Please Help 
Author Message
 Executing message handler function crashes app. Please Help


I have a WinCE application whos only purpose is to send
a message to another application and then close. I use:
HWND FindWindow( LPCTSTR lpClassName, LPCTSTR
lpWindowName ) to get a handle on the FrameWnd of the
application I'm trying to send a message to, and then I
BOOL PostMessage(HWND hWnd, UINT Msg, WPARAM wParam,
LPARAM lParam ) to send the message.
The problem is sometimes the app receiving the message
will crash. Any ideas??

Note: This only happens when the app receiving the
message is a release build; it works fine with a debug

The message handler function prototype is:
afx_msg LRESULT OnAutoLogout( WPARAM, LPARAM );

The message map declaration is:

I also have the message id defined as:

In the app that sends the message I use:
PostMessage( hWnd, WM_APP + 101, 0, 0 );

When I do this the message gets sent and and received. The
message handler function launches a CDialog. When the
dialog is dismissed, the app will be frozen and tapping on
the command bar crashes the app. If I use SendMessage
instead of PostMessage the crash will occur immediately
upon dismissing the CDialog instead of waiting until you
tap on the command bar. Also, if I have add an
AfxMessageBox( ... ) before I bring up the dialog, then it
runs properly. Seems like some kind of timing issue or

Please Help.

Mon, 24 May 2004 03:04:40 GMT  
 [ 1 post ] 

 Relevant Pages 

1. How do I create a user defined Message handler in an app wizard app

2. app receiving message from another app crashes

3. Please help! Crash when returning from function

4. Adding message handler to MFC App

5. Adding Whistler message handler to MFC app...

6. VS7.0 IDE Problem (Can't add Message Handler Function)

7. VS7.0 IDE Problem (Can't add Message Handler Function)

8. Create a new function with a message handler call

9. About user message handler function error..

10. CListBox: assertion failed error when functions are used in message handler of View-Class (SDI)

11. App crashes on MFC messages in Release build

12. Sending message to CPropertySheet crashes app in Release


Powered by phpBB® Forum Software