<System.Runtime.InteropServices.DllImportAttribute("user32.dll", SetLastError:=True)> Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
End Function
Function CloseWindowFromHandle(ByVal hWnd As IntPtr) As Boolean
Const WM_CLOSE As Int32 = &H10
If hWnd = IntPtr.Zero Then
Return False
Else
Return (SendMessage(hWnd, WM_CLOSE, 0, 0) = 0)
End If
End Function
<System.Runtime.InteropServices.DllImportAttribute("user32.dll", SetLastError:=True)> Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
Function GetHandleFromCaption(ByVal sCaption As String) As IntPtr
Return FindWindow(Microsoft.VisualBasic.vbNullString, sCaption)
End Function