Link to home
Start Free TrialLog in
Avatar of jlilley
jlilley

asked on

How to make resizable PropertySheet?

I'm using MFC, and trying to make a subclass of CPropertySheet that is resizable.  I've tried to override CWnd::PreCreateWindow(), but it isn't called.  I can catch WM_NCCREATE using the message map and OR in WS_THICKFRAME to the window style, but that seems to be ignored.  Does anyone know how to do this?
ASKER CERTIFIED SOLUTION
Avatar of RONSLOW
RONSLOW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jlilley
jlilley

ASKER

Although I'm not using NSViews directly, their code contained the secret incantation I was looking for, which I append here for posterity.  Thanks NanoSoft!!!

int CNSFlexPropertySheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
      return -1;

    LONG lSTYLE = GetWindowLong(m_hWnd,GWL_STYLE);
    LONG lEXSTYLE = GetWindowLong(m_hWnd,GWL_EXSTYLE);

    if ((lSTYLE & DS_MODALFRAME) == DS_MODALFRAME)
    {
        lSTYLE &= ~(LONG)DS_MODALFRAME;
        lSTYLE |= WS_THICKFRAME;
      SetWindowLong(m_hWnd,GWL_STYLE,lSTYLE);
    }

    if ((lEXSTYLE & WS_EX_DLGMODALFRAME) == WS_EX_DLGMODALFRAME)
    {
        lEXSTYLE &= ~(DWORD)WS_EX_DLGMODALFRAME;
      SetWindowLong(m_hWnd,GWL_EXSTYLE,lEXSTYLE);
    }
   else
   {
        lEXSTYLE |= (DWORD)WS_EX_CLIENTEDGE;
      SetWindowLong(m_hWnd,GWL_EXSTYLE,lEXSTYLE);
   }

   return 0;
}