Jump to content
Sign in to follow this  
Mbee

How can I prevent my GUI from being moved to another monitor?

Recommended Posts

I'm developing a multi-monitor application which will have two GUIs, one on one monitor and another on a different monitor. Its straightforward to prevent a GUI window from being moved at all, but what I want to do is to allow the user to move and resize the GUIs but to prevent them from moving either GUI off of the monitor it's currently attached to.  I've spent some time investigating this here at the fora and at msdn, but my search-fu is apparently not up to the task of allowing me to find precisely what I'm looking for.

But it certainly seems to me that, since you only receive $WM_MOVE / $WM_SIZE messages only after the move/size is already complete! Now, I realize I could simply force the GUI back to it's original monitor at that point, but that's kinda inelegant. So I'm wondering if I can somehow prevent the move off the current monitor such that the user sees the GUI essentially "bang up" against the monitor boundaries without permitting it to cross in any direction?

It's not a mandatory thing, but it would be more visually elegant.

Thanks.

Share this post


Link to post
Share on other sites

I suddenly remembered how I could do this, (doh!). I'll setup a mouse-down message handler, which will be invoked before any move or resize.  Then I can prevent or allow any move or resize as I see fit, only invoking the default message handler if I want a move/resize to happen.

 

Share this post


Link to post
Share on other sites

Wonderful, Bilgus!  That's extremely helpful, thank you! 

As I was waiting to fall asleep last night, I realized that watching for mouse-down would be utterly useless. If that was all I could detect, I'd need a mind reading UDF to tell me what the user would do next! :>  Stupid! I knew I'd have to find another way when I woke up, and lo and behold, I wake to find your perfect post and extremely helpful post.

Thanks again!

Share this post


Link to post
Share on other sites

"perfect post and extremely helpful post", MBee? That was from the department of redundancy department...

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...