How to prevent window moving
Posted on 2000-01-26
I want prevent the user from being able to move the main (and only) window of my application by grabbing the caption bar. I can't figure out how to do this.
In the PreCreate method of the MainFrm
is set the CREATESTRUCT as follows:
cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE| WS_SYSMENU | WS_MAXIMIZE;
In the InitiInstance of the application, I set:
This creates the window that I want: a maximized window with a title and an X to close it, with no min or max box. It also creates a system menu that I don't need but I found that if I remove that, the top right X to close the application disappears. (I can live with the system menu).
Despite my SHOW_MAXIMIZED, the user can still grab the window by the caption bar and move it around. I would like to prevent that from happening. I also want to keep the window maximized and not allow a min or restore box.
Everything I've thought of doesn't work. Any suggestions?