The program I'm writing uses multiple output windows using the MULTIWIN library. The function FN_createwin returns the handle of the created window. I am using a mouse to access items on the output screen but I need to know that the output window is selected. All the 'window focus' routines only return the main output window, returning @hwnd% . As much as this is, to some extent, useful, it would be good to have the current child window's handle, to guarantee the focus. Is there a routine available.
I tried using either:
Code: Select all
SYS "GetForegroundWindow" TO hwnd%
Code: Select all
DEF FN_getfocus(hwnd%)
LOCAL H%, O%, W%
SYS "GetWindowThreadProcessId", hwnd%, 0 TO W%
SYS "GetCurrentThreadId" TO O%
SYS "AttachThreadInput", O%, W%, TRUE
SYS "GetFocus" TO H%
SYS "AttachThreadInput", O%, W%, FALSE
= H%
(Not sure where I got the second one from, but I've been using it on and off for ages.)
Thanks
Matt