jrg,
The sendmessage function works just like the Win32 SendMessage API call. The messages that are sent are Windows Messages, an example is WM_CLOSE (&H10), sending this message to a window will cause it to close. There are probably 50 or so standard windows messages that can be sent to a running application you can activate a window, simulate a key event, even scroll a window or listbox. Some programs also implement custom windows messages through WM_USER (1024). For example, a couple of programs that I am working on right now act almost like Xlobby plugins through the use of the sendmessage command.
If you have not done any programming, especially win32 API programming, most of the information you will find on send message will probably not help you much. However, I will try and to my best to explain it a little more in detail.
Ok, in order to send a message to a window you have to know it's window handle, hwnd for short. A windows handle is a unique number that gets assigned to every window in the system and changes everytime a program runs. So, to find a hwnd we need 2 pieces of information: The window class name and the Window caption. Of course, window caption is usually fairly easy to get, just look at the window, but the class name requires either the person who wrote the program to tell you, or a program like MS Spy++ (included with MS Visual Studio).
Now that you have the Window Caption and Class Name you can decide what message you want to send. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowMessages/WM_CLOSE.asp for a complete listing (look under notifications on the menu on the left).
Each message can take to different parameters wParam and lParam. I really can't go into too much detail on these because they are specific for each different windows message. An example I can give you is how I use these parameters for a command in my WMP9 plugin. A good example would be the Fast Forward command:
sendmessage:WMP9player:ThunderRT6FormDC:1024:103:5
As you can see the first two parameters are the Window Caption and Class Name. Xlobby uses these 2 parameters to find the hwnd of the window so it can send the message. The third parameter, 1024, is the WM_USER message. Then you have wParam (103) and lParam(5). When my program recieves this message it identifies it as a WM_USER message and looks at wParam to see which command it was sent. Command 103 is fast forward(104 rewind, etc.) Then it looks at lParam (5), this tells the program to skip ahead 5 seconds. So if I sent the message with an lParam of 2 it would fast forward 2 seconds.
I know all of this seems very long, and probably a bit confusing, but it can pay off in the end. You can also do a google search for the win32 API sendmessage command, the parameters are a little different (it needs an hwnd instead of window caption & window class), but it should give you a better idea on how to use windows messaging.