mfccpropertysheet

How to hide propertysheet?


I had a propertysheet where I am facing an issue in hiding the sheet.I will briefly explain what I had done.

In the PropertySheet OnWizardFinish() I am trying hide the sheet and do the following ,

BOOL CSecondEditpage::OnWizardFinish()
{
    BOOL bAsyRet = ShowWindowAsync(m_hWnd,SW_HIDE);
    int MsgRet = ::MessageBox(NULL,L"Do you want to restart",L"Test",MB_YESNO | MB_ICONINFORMATION);
    if(IDYES == MsgRet)
    {
      SystemRestart();
    }
    else
    {
      //Do Nothing..
    }

    return CPropertyPage::OnWizardFinish();
}

So here only the message box should be visible and the sheet should be hidden this is what I am expecting that ShowWindowAsync does.But in the background sheet still exists.

Same thing I tried with a dialog based application there it is working as expected like as,the background window is hidden and only message box is shown .

For more details: enter image description here

And now when I click finish the sheet should be hidden and should show a message box something like this, enter image description here

Can anyone please let me know how can achieve this in propertysheet wizard.


Solution

  • You're trying to hide PropertyPage not a PropertySheet.

    Do like this.

    CPropertySheet* prop = (CPropertySheet*)GetParent();
    ShowWindowAsync(prop->m_hWnd, SW_HIDE);