Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Win32 Multi Monitor & Restore & Ensure Form Position


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Jun 11, 2014 10:01 AM Last Post By: Peter Below
Hanspeter Widmer

Posts: 19
Registered: 10/14/00
Win32 Multi Monitor & Restore & Ensure Form Position  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 5, 2014 6:04 AM
Hello,

just look on the attachment "Win32 Multi Monitor & Restore & Ensure Form Position" what the beef is about.

The question is how to ensure that any restored form/window:

- is not fully placed on the black invisible part
- MS Windows itself allows to move a part on the left as on the right invisible part
- the restore check may have to allow multiple covert monitors
- is there any simple ensure procedure around as MS Windows allows

Any comment is welcome

Hp
Hanspeter Widmer

Posts: 19
Registered: 10/14/00
Re: Win32 Multi Monitor & Restore & Ensure Form Position  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 10, 2014 12:58 AM   in response to: Hanspeter Widmer in response to: Hanspeter Widmer
Is this thread in the false forum?

Hp
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: Win32 Multi Monitor & Restore & Ensure Form Position  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 10, 2014 10:03 AM   in response to: Hanspeter Widmer in response to: Hanspeter Widmer
Hanspeter Widmer wrote:

Is this thread in the false forum?

No, we are all just jealous of your setup ;-).

I think you have to check the form boundsrect against the work rect of
each monitor in turn to make sure it is completely inside one monitor,
or at least not partially outside any of them.

What may be helpful here is to use Windows regions. You can construct a
region by starting with the full virtual screen and subtract the
individual monitor rectangles from that. That gives you a region that
only includes the black areas (not part of any monitor). Then intersect
this region with a region created from the form bounds rect and check
whether the resulting region is empty. If not the form extends into one
of the black areas.

API functions to check: CreateRectRgn, CombineRgn, DeleteObject.

--
Peter Below (TeamB)
Chris Morgan

Posts: 2
Registered: 4/13/00
Re: Win32 Multi Monitor & Restore & Ensure Form Position  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 10, 2014 2:33 PM   in response to: Peter Below in response to: Peter Below
On 10/06/2014 18:03, Peter Below wrote:
Hanspeter Widmer wrote:

Is this thread in the false forum?

No, we are all just jealous of your setup ;-).

I think you have to check the form boundsrect against the work rect of
each monitor in turn to make sure it is completely inside one monitor,
or at least not partially outside any of them.

What may be helpful here is to use Windows regions. You can construct a
region by starting with the full virtual screen and subtract the
individual monitor rectangles from that. That gives you a region that
only includes the black areas (not part of any monitor). Then intersect
this region with a region created from the form bounds rect and check
whether the resulting region is empty. If not the form extends into one
of the black areas.

API functions to check: CreateRectRgn, CombineRgn, DeleteObject.

Far too complicated!
I used to have a similar problem, which manifested most often
when using programs on laptops which are docked/undocked
with different screen sizes.

I now use GetWindowPlacement and SetWindowPlacement to save
and restore window positions - these are Win API functions.
SetWindowPlacement will automatically adjust the position
of the form so that at least some part of it is visible - read
the docs.

cheers,

Chris
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: Win32 Multi Monitor & Restore & Ensure Form Position  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 11, 2014 10:01 AM   in response to: Chris Morgan in response to: Chris Morgan
Chris Morgan wrote:

I now use GetWindowPlacement and SetWindowPlacement to save
and restore window positions - these are Win API functions.
SetWindowPlacement will automatically adjust the position
of the form so that at least some part of it is visible - read
the docs.

I know, but the specs said that all of the form has to be visible, if
I understood it correctly.

--
Peter Below (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02