CloseMainWindow, should be equivelant to clicking the close button on a form.
However you can use API like this:
VB Code:
  1. 'Top of the form below imports etc
  2. Const WM_CLOSE = &H10
  3. Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Object) As Integer
  4. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
  5.  
  6. 'In some event like a button click, post the message like this:
  7. PostMessage(FindWindow(vbNullString, exe.MainWindowTitle.ToString()), WM_CLOSE, 0, 0)
Otherwise you'll need to automate these with virtual keys.
I can help with that too, if you need.