Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getwindowstext API
Message
From
23/11/1998 11:21:12
Jody Cairns
OAO Technology Solutions
Moncton, New Brunswick, Canada
 
 
To
23/11/1998 03:52:02
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00160417
Message ID:
00160510
Views:
20
>Who know how to use this functuion .
>My window is VB(“FORM1”).

Assuming you mean how to use the GetWindowText API function, here's one quick and dirty way to get the text of a window. This works for controls, too. Check http://premium.microsoft.com/msdn/library/sdkdoc/winui/windows_5gms.htm for info on this function.

Of course, the easiest way to get a VB form title within a VB program is using the Caption property.
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
  (ByVal hwnd As Long, _
   ByVal lpString As String, _
   ByVal cch As Long) _
  As Long

function GetWindowCaption(lHandle as long) as string
  Dim lLength As long
  Dim sTitle As String

  sTitle = Space(256)
  lLength = GetWindowText(lHandle, sTitle, 255)

  GetWindowCaption = Left$(sTitle, lLength)

end function
Previous
Reply
Map
View

Click here to load this message in the networking platform