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!

[sourcecode language=’cpp’]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
ModifyStyle( WS_DLGFRAME, WS_OVERLAPPEDWINDOW, 0 );

return CPropertySheet::OnInitDialog();
}// End OnInitDialog[/sourcecode]

5 thoughts on “Making a property sheet window resizable!

  1. Thanks,
    That is very really nice piece of code.

    But i found one problem, after resizing the sheet, if switch between pages, the controls in the page disappear, any reason why?
    I am using VS 2012.

    Saleem

Appreciate your comments...