Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find window title

Status
Not open for further replies.

Serban

Programmer
Sep 25, 2001
36
0
0
RO
Hi!

How can I find the window title if I have hWnd.

Thanks

Mircea Serban
 
This should work...

Code:
Private Declare Function GetWindowText Lib "user32" Alias _
    "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, _
    ByVal cch As Long) As Long


Private Function GetWindowName(ByVal hWindow As Long) As String
    Dim strTitle As String * 80
    Dim lngLength As Long
    lngLength = GetWindowText(hWindow, strTitle, Len(strTitle))
    If lngLength Then
      GetWindowName = strTitle
    Else
      GetWindowName = ""
    End If
End Function

HTH, Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top