View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Thu Aug 22, 2019 5:34 pm Post subject: When a Window changes |
|
|
I know how to get the size and position of a window. What I didn't expect is that when the window is minimised the callback returns some pretty weird values. In my case, with two monitors, the position/size returns -32000 for both the X and Y position, and what would appear to be a width and height about equal to the menu bar.
My question is: Is there a way to determine whether the size/position callback has been called as a result of a minimise operation? I see "RESIZE" is a possibility, but it doesn't give me the insight I was looking for. Unless, when minimising, there is always a set value for X and Y, for example. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Aug 22, 2019 6:43 pm Post subject: |
|
|
One possible approach is to call the Windows API function IsIconic. This tells you whether or not the window is currently minimised. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Aug 22, 2019 6:51 pm Post subject: |
|
|
I think those are the right coordinates - they minimised coords appear to have varied between old Windows versions but stabilised to (-32000, -32000) with NT and later.
There's a function GetWindowPlacement function (MSDN) that can give you the miniised Window coords - worth looking at.
Paul's solution is probably best.
Eddie |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Thu Aug 22, 2019 7:36 pm Post subject: |
|
|
Paul and Eddie, thanks for the hints. I'll pursue it! |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Thu Aug 22, 2019 7:49 pm Post subject: |
|
|
IsIconic works great, and since it returns a LOGICAL, easy enough to use!
Thanks!! |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Thu Aug 22, 2019 10:02 pm Post subject: |
|
|
Bill,
Quote: | the position/size returns -32000 for both the X and Y position, and what would appear to be a width and height about equal to the menu bar. |
That's one weird 'standard to hit on whatever version of windows one might have.
It's (well) off-screen !
I'd guess the width and height refers to the 'icons bar' i.e. the zone along the bottom of the screen just above the task bar where minimized windows icons are placed.
The other question to be considered is, what happens if there is more than one reduced window ?
Do all have the same (offscreen) position co-ordinate then I assume (which indicates simply that the window is reduced to an icon) ? or does windows go all bohemian and create a rhapsody of different 'position' co-ordinates for each icon I wanda.
Not forgetting what it might produce if the task bar was not the standard heigt or positioned at one of the other sides of the screen.
I remember some previous discussions we had on posts concerning MDI child windows and that at the time some positions of minimized windows icons were not consistent with what one expected.
Maybe that could have been related to similar subtle issues regarding positioning parameters . _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
Back to top |
|
|
|