10-28-2022, 05:11 PM
Windows API for set window active should register a number in this little test routine, but it doesn't. I threw in a couple of other API functions that register just fine. Anyone know what I missed here?
Pete
Code: (Select All)
DECLARE DYNAMIC LIBRARY "user32"
FUNCTION SetActiveWindow& (BYVAL hwnd AS LONG)
FUNCTION GetWindow& (BYVAL hwnd AS LONG, BYVAL nCmdShow AS LONG)
FUNCTION FindWindowA& (BYVAL ClassName AS LONG, WindowName$) 'handle by title
END DECLARE
title$ = "Set Window Active Test"
_TITLE (title$)
_DELAY .1
DO
hwnd& = FindWindowA(0, title$)
LOOP UNTIL hwnd&
DO
_LIMIT 10
c& = GetWindow(hwnd&, 1) ' Just put this in to show it does register.
a& = SetActiveWindow(hwnd&) ' This one should registere, but doesn't. <==============
PRINT "This should be non-zero:"; a&; " These are fine:"; c&, hwnd&
SLEEP 4
IF LEN(INKEY$) THEN END
LOOP
Pete