Detect when mouse leaves program window
#18
(08-17-2023, 05:34 PM)SpriggsySpriggs Wrote: Hmmm.... GetClientRect might take it into account. It reports the coordinates of each corner, if I'm not mistaken.
After testing it seems GetClientRect returns (0,0) - (_WIDTH(0), _HEIGHT(0))

Code: (Select All)
TYPE RECTAPI
    left AS LONG
    top AS LONG
    right AS LONG
    bottom AS LONG
END TYPE

DIM apirect AS RECTAPI

DECLARE DYNAMIC LIBRARY "user32"
    'https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getclientrect
    FUNCTION GetClientRect% (BYVAL hWnd AS LONG, lpRect AS RECTAPI)
END DECLARE

SCREEN _NEWIMAGE(800, 600, 32)
_DELAY .25 ' small delay for window to be created
tmp = GetClientRect(_WINDOWHANDLE, apirect)

PRINT apirect.left
PRINT apirect.top
PRINT apirect.right
PRINT apirect.bottom
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply


Messages In This Thread
RE: Detect when mouse leaves program window - by TerryRitchie - 08-17-2023, 09:15 PM



Users browsing this thread: 5 Guest(s)