Posts Tagged ‘GetSystemMenu’

Making a property sheet window resizable!

March 27, 2008 3 comments

Sometime back my boss asked me to write a test application for a layout manager. This test application was for testing layout manager on a property sheet!

Hmm so property sheet cannot be resized even if you modify the style of a property sheet. Well the reason why it can’t be resized is because SC_SIZE menu is missing from the property sheet system menu (Press Alt and Spacebar)!

Restore system menu by calling GetSystemMenu(TRUE), but this unfortunately doesn’t work unless we call GetSystemMenu(FALSE) first! Along with this modify the style of property sheet window to make it resizable.

Well now you might think why the heck then do we have to change the system menu if there is a style for resizing. The problem is you will see the resize mouse cursor on the borders of this property sheet but the dragging part won’t work, unless SC_SIZE is restored back to the system menu!

BOOL MyPropSheet::OnInitDialog()
   // This first call is mandatory, call with revert flag set to false
   CMenu* pMenu = GetSystemMenu( FALSE );
   ASSERT( pMenu );

   // Call once more with revert flag set to true to restore original system menu
   GetSystemMenu( TRUE ); // This reverts to original system menu
    // Also don't forget to change the style to resizable

   return CPropertySheet::OnInitDialog();
}// End OnInitDialog

How to disable close button on window caption bar?

Creating an unmovable dialog!

March 7, 2008 2 comments

Just try this from OnInitDialog, this trick will make any window unmovable.

CMenu* pSysMenu = GetSystemMenu(FALSE);
pSysMenu->RemoveMenu(SC_MOVE, MF_BYCOMMAND);

Lol lol now it’s not moving. Ah no!!! Now tell me how can I make it movable again? Lol the funniest question of the century…ROTFL. 🙂

%d bloggers like this: