CodeItBetter Programming Another VB Programming Blog

How to get the title of the Active Window

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'System & API - How to get the title of the Active Window
Option Explicit
 
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
 
Public Function GetActiveWindowTitle(ByVal ReturnParent As Boolean) As String
    Dim I As Long, J As Long
    I = GetForegroundWindow
    If ReturnParent Then
        Do While I <> 0
            J = I
            I = GetParent(I)
        Loop
        I = J
    End If
    GetActiveWindowTitle = GetWindowTitle(I)
End Function
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.