topiaiop.blogg.se

Getwindowtext vba example
Getwindowtext vba example




LhWndP = FindWindow(vbNullString, vbNullString) 'PARENT WINDOW Private Function GetHandleFromPartialCaption(ByRef lWnd As Long, ByVal sCaption As String) As Boolean MsgBox "Window 'Excel' not found!", vbOKOnly + vbExclamation MsgBox "Found INVISIBLE Window Handle: " & lhWndP, vbOKOnly + vbInformation MsgBox "Found VISIBLE Window Handle: " & lhWndP, vbOKOnly + vbInformation If GetHandleFromPartialCaption(lhWndP, "Excel") = True Then Private Declare Function IsWindowVisible Lib "User32" (ByVal hWnd As Long) As Boolean Private Declare Function GetWindow Lib "User32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long Private Declare Function GetWindowTextLength Lib "User32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long Private Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long You can retrieve the window handle of the popup, which you need to use SendMessage, by using the below code: Option Explicit You can close the popup by sending it a WM_CLOSE message using SendMessage Win32API.






Getwindowtext vba example