RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
May 19, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

WindowDescription - Get a textual description of a window given its hWnd

Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal _
    hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
    (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

' Return a text description of a given window
' (consists of hWnd and classname, optionally followed by caption)

Function WindowDescription(ByVal hWnd As Long) As String
    Dim buffer As String * 256
    Dim length As Long
    Dim text As String
    Dim classname As String
    length = GetWindowText(hWnd, buffer, Len(buffer))
    text = Left$(buffer, length)
    length = GetClassName(hWnd, buffer, Len(buffer))
    classname = Left$(buffer, length)
    WindowDescription = "[" & Right$("0000000" & Hex$(hWnd), _
        8) & "] " & classname
    If Len(text) Then
        WindowDescription = WindowDescription & " - """ & text & """"
    End If
End Function
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date