Searching...
12:53 AM

Get Window Caption VB6 Code

Code:
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 GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long

Function GetCaption(WindowHandle As Long) As String
    On Error Resume Next
    Dim buffer As String, TextLength As Long
        TextLength& = GetWindowTextLength(WindowHandle&)
        buffer$ = String(TextLength&, 0&)
        Call GetWindowText(WindowHandle&, buffer$, TextLength& + 1)
        GetCaption$ = buffer$
                    
End Function

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Back to top!