Send Windows Messages to Your App

Started by Thorin, October 25, 2010, 02:03:18 PM

Previous topic - Next topic

Thorin

If you develop applications to run on Windows, you hopefully know that Windows is really just a giant looping message pump.  So how do you send Windows messages (WM_CLICK, WM_ENDSESSION, WM_LOSEFOCUS, etc) to your app to be able to test your code?

The developer of TortoiseSVN has made a tool called SendMessage that allows you to do exactly that:

http://tools.tortoisesvn.net/SendMessage

I especially like the example of WM_ENDSESSION, because this is supposed to cause your app to shut down properly but you wouldn't be able to debug it because Visual Studio (or whatever you use) would also be getting shut down.
Prayin' for a 20!

gcc thorin.c -pedantic -o Thorin
compile successful