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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API Call (GetWindowTextLength), simple.

Status
Not open for further replies.

msuryadarma

Programmer
Oct 13, 2000
3
US
Hi. I'm trying to call API to get the length of a Window's title. Here's the code:

I declared these in the Declare Local External Functions space:
--------------------
Function Long GetDesktopWindow() Library "user32.dll"
Function Long GetWindowTextLength(Long hWnd) Library "user32.dll"

Then in the click event of a cb:
--------------------
Long winhandle //container for desktop window's handle
Long textlen //receives length of text of the desktop window

//getting the desktop window's handle. This function WORKS!
winhandle = GetDesktopWindow()

//Find out how many characters are in the window's text.
textlen = GetWindowTextLength(winhandle)


Now I keep getting errors executing GetWindowTextLength. Any ideas? Thanks a lot.
 
There are usually two variants of API functions.
Unicode and standard.
Define GetWindowTextLengthA instead of GetWindowTextLength
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top