Home > Windows API > Making a property sheet window resizable!

Making a property sheet window resizable!

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
  1. John
    October 5, 2009 at 4:46 pm

    This is what I like – nifty bits of code to do just what I needed.
    My most humble thanks

  2. Emily
    May 5, 2009 at 11:57 pm

    Thank you so much for the useful information.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: