SendMessage is a little tool to send Windows messages to any window. You can test your application by actually triggering system 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 WPARAM and LPARAM manually.