VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Find Any Window

DoWnLoHo  (14 Submissions)   VB function enhancement   Visual Basic 3.0   Beginner   Wed 3rd February 2021

Sometimes you need to find a window using the API Call findwindow , but what if this windows caption changes
you can't find that same window all the time. With this function you can find any window just by knowing a few letters
in the caption. This will return the windows' hWnd , also includes a function that will grab the windows caption.
This is something that will be useful to alot of programmers. Updated! 2.23.01

Assumes
call it like so call msgbox(FindAnyWindow&(me,"text of window")) or to get the caption do this call msgbox(getcaption$(FindAnyWindow&(me,"text of window")))

Side Effects
none(that I know of)

API Declarations
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetNextWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wFlag As Long) As Long

Rate Find Any Window (7(7 Vote))
Find Any Window.bas

Find Any Window Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters