CloseMainWindow, should be equivelant to clicking the close button on a form.
However you can use API like this:Otherwise you'll need to automate these with virtual keys.VB Code:
'Top of the form below imports etc Const WM_CLOSE = &H10 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 Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer 'In some event like a button click, post the message like this: PostMessage(FindWindow(vbNullString, exe.MainWindowTitle.ToString()), WM_CLOSE, 0, 0)
I can help with that too, if you need.![]()




Reply With Quote