Is _WINDOWHANDLE working properly?
#1
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?

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
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply


Messages In This Thread
Is _WINDOWHANDLE working properly? - by TerryRitchie - 08-17-2023, 08:41 PM
RE: Is _WINDOWHANDLE working properly? - by Dav - 08-17-2023, 08:53 PM
RE: Is _WINDOWHANDLE working properly? - by Dav - 08-17-2023, 09:37 PM
RE: Is _WINDOWHANDLE working properly? - by Dav - 08-17-2023, 10:09 PM
RE: Is _WINDOWHANDLE working properly? - by Dav - 08-18-2023, 01:14 PM
RE: Is _WINDOWHANDLE working properly? - by Dav - 08-18-2023, 03:29 PM
RE: Is _WINDOWHANDLE working properly? - by Dav - 08-18-2023, 04:47 PM



Users browsing this thread: 1 Guest(s)