08-17-2023, 08:41 PM
First, I'm a complete noob to API calls so this just may be my ignorance on the subject.
@SpriggsySpriggs suggested I use GetClientRect to get the client area coordinates of a Window. So I set up some code below to investigate.
However, no matter what size the screen is set to the return values of the RECT are always 0,0 - 640,400.
This makes me think that perhaps _WINDOWHANDLE is pointing to an underlying console window instead of the currently visible window?
Am I correct in my thinking, or am I using _WINDOWHANDLE incorrectly?
@SpriggsySpriggs suggested I use GetClientRect to get the client area coordinates of a Window. So I set up some code below to investigate.
However, no matter what size the screen is set to the return values of the RECT are always 0,0 - 640,400.
This makes me think that perhaps _WINDOWHANDLE is pointing to an underlying console window instead of the currently visible window?
Am I correct in my thinking, or am I using _WINDOWHANDLE incorrectly?
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) ' results the same no matter what size screen is used??
tmp = GetClientRect(_WINDOWHANDLE, apirect)
PRINT apirect.left
PRINT apirect.top
PRINT apirect.right
PRINT apirect.bottom