I am writing a vb program that utilizes two separate applications. One is the user interface and display the other is for data acquisition through usb. To communicate between the two applications I would like to use the PostMessage() API.

I am having trouble understanding how the application interprets the message. I read an article for closing an application that had the sample code below:

Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function PostMessage Lib "user32" Alias _
"PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long


Sub CloseProgram()

Dim winHwnd As Long
Dim RetVal As Long
Const WM_CLOSE = &H10

winHwnd = FindWindow(vbNullString, "Calculator")
If winHwnd <> 0 Then
RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&)
End If

End Sub

So here is the question. The Const WM_CLOSE = &H10, how do you come up with &H10? Are the standard WM_ values defined somewhere? I am not interested specifically the WM_CLOSE but all of the WM_ messages.

Also is there a way to define your own WM_ and have the other application respond.

Anyone have any answers.