QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: Cobalt on January 06, 2019, 12:31:23 pm
-
Is it possible to get the currently active program's window X and Y positions?, I know we can get its handle, but can we return its position on the desktop?
-
Is it possible to get the currently active program's window X and Y positions?, I know we can get its handle, but can we return its position on the desktop?
http://qb64.org/wiki/SCREENX
http://qb64.org/wiki/SCREENY
-
It should be noted, that both functions return -32000, if the window is currently minimized. Also be aware of negative positions, if the window is dragged partly off the desktop with its top/left border.
-
I use negative positioning when I want to copy the desktop but get rid of the title bar. Very useful.
Pete
-
Is it possible to get the currently active program's window X and Y positions?, I know we can get its handle, but can we return its position on the desktop?
http://qb64.org/wiki/SCREENX
http://qb64.org/wiki/SCREENY
when I tried that it gave me MY programs X\Y pos not the currently active Windows X\Y. which I thought was odd cause I used _SCREENHIDE on my program at the time. unless I used it wrong.
-
You’ll want a declare library routine to get another window’s X/Y position.
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getwindowinfo — this one, maybe.
-
i think what I might need is this,
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getwindowrect
but I'm not knowledgeable enough to know quite how to set that up. I have only dabbled in this a little with even littler success.
I think I start with
DECLARE LIBRARY 'function is already used by QB64 so "User32" is not required
but like I said I'm NOT knowledgeable enough to know just how to setup the Declare Library part. I could certainly use some help on that part.