Making a modeless property sheet not-moveable?
Patrick Davis -- flowenol@erols.com Thursday, March 20, 1997 Environment: Win95/MSVC++4.0 Is it possible to make a modeless or modal property sheet dialog so that it cannot be moved by the user? ie normally by clicking on the frame you can move the dialog, I would like to make it so a user cannot change the location within the window of a property sheet dialog. Any ideas would be appreciated. Thanks Patrick Davis flowenol@erols.com
ktm@ormec.com Monday, March 24, 1997 [Mini-digest: 2 responses] On mfc-l, Patrick Davis (flowenol@erols.com) wrote: > Environment: Win95/MSVC++4.0 > > Is it possible to make a modeless or modal property > sheet dialog so that it cannot be moved by the user? > ie normally by clicking on the frame you can move the > dialog Do it the same way you'd make any dialog non-movable, by removing the SC_MOVE item from the system menu. So for a property sheet, you need to derive a class from CPropertySheet, and put the following code in your OnInitDialog: CMenu* pSystemMenu = GetSystemMenu(FALSE); if (pSystemMenu != NULL) { pSystemMenu->DeleteMenu(SC_MOVE, MF_BYCOMMAND); } Whether this is actually a good idea will have to be determined during your user-interface testing. (Most people expect to be able to move all the windows around on the screen). Katy -- Katy Mulvey <mailto:ktm@ormec.com> Software Development Engineer ORMEC Systems -----From: Sreekant SreedharanPatrick Davis wrote: > > Environment: Win95/MSVC++4.0 > > Is it possible to make a modeless or modal property > sheet dialog so that it cannot be moved by the user? > ie normally by clicking on the frame you can move the > dialog, I would like to make it so a user cannot change the > location within the window of a property sheet dialog. > > Any ideas would be appreciated. Thanks > > Patrick Davis > flowenol@erols.com I think you can override WM_MOVE (CWnd::OnMove()) and force the window to be fixed at a single place. But I don't agree that a popup window of any sort be forced to stick to one place. -- - From Sreekant Sreedharan
Carl Gunther -- cgunther@ix.netcom.com Monday, March 31, 1997 Hi, The usual way to make a window immobile (and also to more selectively restrict its mobility) is to handle the WM_WINDOWPOSCHANGING message and alter the members of the structure that it passes to you by reference. I haven't specifically tried this with a dialog or a property sheet, but it ought to work. It's true that for dialogs the Windows dialog manager has its own message loop that prevents certain messages from reaching the dialog window, but I _think_ that this just grabs the keyboard input, so you still ought to be able to trap WM_WINDOWPOSCHANGING. If for any reason you have trouble getting this message, you might want to look at CWinApp::ProcessMessageFilter() and try to trap it there. Best wishes, Carl Patrick Davis wrote: > > Environment: Win95/MSVC++4.0 > > Is it possible to make a modeless or modal property > sheet dialog so that it cannot be moved by the user? > ie normally by clicking on the frame you can move the > dialog, I would like to make it so a user cannot change the > location within the window of a property sheet dialog. > > Any ideas would be appreciated. Thanks > > Patrick Davis > flowenol@erols.com -- Copyright 1996 Carl E. Gunther. Permission to reproduce this message in text form for not-for-profit purposes freely granted provided that the preceeding copyright notice is retained.
Become an MFC-L member | Вернуться в корень Архива |