views:

37

answers:

2

How would one use SendMessage() or PostMessage() function to close an application, given that the appropriate window handle is retrieved? Thanks in advance.

+1  A: 

Call the PostQuitMessage function which will post a WM_QUIT message for you.

Stephen Nutt
How does the application know which app to close (I don't see a HWND parameter in this function)?
stanigator
+2  A: 
SendMessage(hWnd, WM_CLOSE, 0, 0);
Alan