Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Prod

Stopping a window from moving

This topic is 5791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my project (VC++, OGL) I need a way to keep the user from moving the window, otherwise my mouse function goes haywire. Everything works perfect when in fullscreen and when the window''s top left corner is in the monitors top left corner. thanks!

Share this post


Link to post
Share on other sites
Advertisement
Process the WM_MOVING message. Simply create an RECT structure somewhere in your program with the coordinates of the window (I think the return value from GetWindowRect should be fine) and do this while processing WM_MOVING:

case WM_MOVING:
lprc = reinterpret_castlparam;
*lprc = savedWindowRect;

Share this post


Link to post
Share on other sites
Evil Bill and niyaw are correct: fix your app. That said, you can probably alter Win32 window styles to disable movement. Check MSDN for more info.

Share this post


Link to post
Share on other sites
I know its bad app design if i have to stop the user from moving the window, but im not sure how to attack the problem any other way besides forcing fullscreen.

thanks anyways

Share this post


Link to post
Share on other sites
quote:
Original post by Prod
I know its bad app design if i have to stop the user from moving the window, but im not sure how to attack the problem any other way besides forcing fullscreen.



Ehm. Your mouse routines are bugged. Therefor you need to fix your bugs. Im almost certain that your problem is that you read mouse screen coordinates (windows desktop) instead of the windows coordinates.

Either you
a) Change the routines to use correct coordinates and api calls.
b) recalculate your coords with stupid stuff like mousex-=windowx; mousey=-windowy;

Preferable A obviously.



- Zorak - Neat Fella.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!