VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "App"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
' Copyright (c) 1995-1997 by Desaware.

Private Declare Function APIGetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function APIGetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long


Public Function GetWindowText(ByVal usewnd As Long) As String
    Dim textlen As Long
    Dim res$
    textlen = APIGetWindowTextLength(usewnd) + 1
    res$ = String$(textlen + 1, 0)
    Call APIGetWindowText(usewnd, res$, textlen)
    GetWindowText = res$
End Function
