SendMessage is a little tool to send Windows messages to any window.
Ever wondered how you should test whether your application correctly responds to certain system messages like
WM_POWERBROADCAST? Of course you can test your application by actually triggering those messages, but especially the
WM_ENDSESSION message and its purpose makes it impossible to attach a debugger to your application once Windows sends you that message.
With this tool, you can send that message and any other message you like to your application window. And you can do that while you have a debugger attached to your application!
To find the window handle of your application, either drag the target icon in the upper left to your main window, or click on the "Windows" button and select the window from the list.
There are a few window messages predefined in SendMessage. If you need to send a message that is not in the list, just enter the number of the message and any required values for
LPARAM manually. The screenshot below shows how this would look like for the
Once you've entered the message information, click on either the "SendMessage" or "PostMessage" button and the message is sent or posted to your window.
If you find any bugs or have suggestions for new features, please enter them in the issue tracker.
To download the tool, go to the download page.
Command line usage
SendMessage can also be used from a command line:
- specifies the window message to send or post as a decimal value
- specifies the WPARAM
- specifies the LPARAM
- optional: if specified, the message is sent using PostMessage. If it's not specified, the message is sent using SendMessage.
- the window handle to send the message to as a decimal value
- the message is sent to any window that matches the specified title text
- the message is sent to any window that has the specified window class
- the message is sent only to windows that are part of the specified process
/processname:TTTT is specified without any window title, class or handle, the message is sent to the top level window of the specified process(es).
SendMessage.exe /message:16 /processname:cmd.exeSends a
WM_CLOSEmessage to all open console windows.