Use the FindWindow API.
The following example will get the hWnd of Calculator and Send a message to close it.
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10
Private Sub Command1_Click()
'Get the Handle of Calculator.
MyHwnd = FindWindow(CLng(0), "Calculator")
SendMessage MyHwnd, WM_CLOSE, 0&, 0&
End Sub