Archived

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

Prod

Stopping a window from moving

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
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
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