06-07-2024, 07:01 PM
I'm trying to get the name of the current window that has focus. I've already successfully figured out how to get the window handle of any window in focus but I'm having trouble getting the window's title. According to Microsoft's docs here:
https://learn.microsoft.com/en-us/window...indowtextw
GetWindowTextW should be able to do this. ( There is also a GetWindowTextA function for ASCII return but that's not working for me either. )
It's pretty straight forward:
DECLARE DYNAMIC LIBRARY "user32"
FUNCTION GetWindowTextW (BYVAL hWnd AS _INTEGER64, lpString AS STRING, BYVAL nMaxCount AS INTEGER)
END DECLARE
DIM Dummy AS INTEGER
DIM n AS STRING
_TITLE "This is a test"
Dummy = GetWindowTextW(_WINDOWHANDLE, n, 255)
PRINT n
Does anyone have any insights on why this is not working? The string seems to be null and Dummy returns the value of 0.
https://learn.microsoft.com/en-us/window...indowtextw
GetWindowTextW should be able to do this. ( There is also a GetWindowTextA function for ASCII return but that's not working for me either. )
It's pretty straight forward:
DECLARE DYNAMIC LIBRARY "user32"
FUNCTION GetWindowTextW (BYVAL hWnd AS _INTEGER64, lpString AS STRING, BYVAL nMaxCount AS INTEGER)
END DECLARE
DIM Dummy AS INTEGER
DIM n AS STRING
_TITLE "This is a test"
Dummy = GetWindowTextW(_WINDOWHANDLE, n, 255)
PRINT n
Does anyone have any insights on why this is not working? The string seems to be null and Dummy returns the value of 0.