Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetWindowTextW - can you get it to work?
#3
A working example, plus a few changes which you'll want to make use of:

Code: (Select All)
DECLARE DYNAMIC LIBRARY "user32"
FUNCTION GetWindowTextA (BYVAL hWnd AS _OFFSET, lpString AS STRING, BYVAL nMaxCount AS INTEGER)
FUNCTION GetWindowTextW (BYVAL hWnd AS _OFFSET, lpString AS STRING, BYVAL nMaxCount AS INTEGER)
END DECLARE

DIM Dummy AS INTEGER
DIM n AS STRING * 255

_TITLE "This is a test"
Dummy = GetWindowTextA(_WINDOWHANDLE, n, 255)
PRINT n
Dummy = GetWindowTextW(_WINDOWHANDLE, n, 255)
PRINT n
_DELAY .5
Dummy = GetWindowTextA(_WINDOWHANDLE, n, 255)
PRINT n
Dummy = GetWindowTextW(_WINDOWHANDLE, n, 255)
PRINT n


Note that since this is a Windows call, you'll need a delay after the _TITLE to give the OS time to update things to return the proper title for you.

Also note that I'm passing an _OFFSET and not an _INTEGER64.

And you can see the difference in A and W function calls here.

Also notice the STRING * 255 here. Wink
Reply


Messages In This Thread
RE: GetWindowTextW - can you get it to work? - by SMcNeill - 06-07-2024, 07:21 PM



Users browsing this thread: 5 Guest(s)