Click to See Complete Forum and Search --> : How to make a window immovable?!?
vittal
May 2nd, 1999, 11:38 PM
Hi All,
Is there any way to make a Dialog Based Application immovable?? i.e., I dont want the user to move the application window.
%
Bernd Holz
May 3rd, 1999, 12:52 AM
Hi,
I di not try that but I think simply overriding WM_MOVE should work.
Regards,
Bernd
Paul McKenzie
May 3rd, 1999, 03:53 AM
Capture WM_NCHITTEST. If you call DefWindowProc() when you capture WM_NCHITTEST you will get HT_CAPTION if the mouse is in the caption bar. If you then return HT_NOWHERE, the window will not move.
switch(msg) {...
case WM_NCHITTEST:
UINT nPos = DefWindowProc(...);
if ( nPos == HT_CAPTION ) return HT_NOWHERE;
return nPos;
...
}
You may also have to check for WM_SYSCOMMAND and check if SC_MOVE is selected, or make sure that your app does not have a system command menu, since the user can also move the window using the keyboard.
I don't think that capturing WM_MOVE will work, since this is called *after* the user has attempted to move the window. The user will still be able to use the mouse to start the movement, and if they have full screen drag on, they will still see the window
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.