![]() ![]() 'and where the Window title starts with WindowTitle, returns Hwnd 'finds the first window where the class name starts with ClassName Private Declare Function GetClassName Lib "user32" _įunction FindWindowHwndLike(hWndStart As Long, _ Private Declare Function GetWindowText Lib "user32" _ Private Declare Function GetWindow Lib "user32" _ Private Declare Function GetDesktopWindow Lib "user32" () As Long ' at this point hWnd has a caption of WinCaption If hWnd = 10000 Then Stop ' window not found ![]() ILen2 = GetWindowText(hWnd, sStr, iLen1 + 1) ZFind = FindWindow(vbNullString, WinCaption)įunction zSrch&(WinCaption$) ' search all windows ![]() MsgBox WinCaption & ": " & hWnd1 & ", " & hWnd2 The 2nd Msgbox shows FindWindow doesn't find.ĭeclare Function FindWindow Lib "user32" Alias "FindWindowA" ( _īyVal lpClassName As String, ByVal lpWindowName As String) As Longĭeclare Function GetWindowText Lib "user32" Alias "GetWindowTextA" ( _īyVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) Asĭeclare Function GetWindowTextLength Lib "user32" AliasĬall Sub2("Microsoft Excel - Book1") ' hWnds = The 1st Msgbox shows both methods working. Windows and finds some that FindWindow doesn't. I've had occasion to, given a Window Caption, to want the HWnd.īut my routine zSrch, using GetWindowText, searches all the ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |