Hi

Why can't I use SendMessage, to exit my program -
it doesn't work in this procedure:

ExitProc    proc

; LOCAL hWnd:HWND
invoke PostQuitMessage,NULL
; invoke SendMessage,hWnd,WM_COMMAND,IDC_EXIT,0
ret

ExitProc end


When I tried with PostQuitMessage, it worked fine :)
I think it's the"hWnd", which is the problem...


regards,


The SharK
Posted on 2004-12-01 16:44:33 by The SharK
Tiburon, it is probably that your windows proc does not manage the message you are sending (uMsg=WM_COMMAND and wParam=IDC_EXIT). If this not help, post your code to let us help you.
Posted on 2004-12-01 17:04:44 by Kecol
he's right - try sending a WM_QUIT, and make hWnd an input param:

ExitProc proc hWindow
; invoke PostQuitMessage,NULL
invoke SendMessage,hWindow,WM_QUIT,0,0
ret

ExitProc endp

You don't need to handle the WM_QUIT message in WndProc yourself because your MessagePump is "peeking" at the incoming WM's and looking for WM_QUIT before tossing each WM at WndProc (via DispatchMessage)
Posted on 2004-12-01 19:16:35 by Homer