0

I am looking for a way to watch for specific messages sent by the system to my application. For example, I want to be able to watch for the WM_QUERYENDSESSION message and when it is received, to perform a specific action.

I am working with the python win32 extensions, but I'm sure that I could translate the equivalent code in another language.

I know how to use SendMessage to send messages to other windows, but I don't know what to use to watch for messages sent to my window.

Any help is appreciated.

4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by jen140
0

in c++ you would go:

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		    case WM_QUERYENDSESSION:
                    {
                        //the action to use when it receives this message
                    }
		}
	case WM_CLOSE:
		DestroyWindow(hwnd);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}

hope that helps :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.