15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Not resizable CMDIChildWnd...

Reza Razavipour -- biles.com!reza_r@jabberwock.biles.com
Monday, January 15, 1996

I am running VC 4.0 patch one, on NT3.5.1.

I have these CMDIWndChild derived frame classes that I dont the user to
be able to change their size. How can I do this?

About their title, I want to be able to set it, no tweaking by the
frameworks.

Any hints are highly appreciated,

Reza



Mark F. Fling -- mfling@mail.stratacorp.com
Wednesday, January 17, 1996

biles.com!reza_r@jabberwock.biles.com (Reza Razavipour) wrote:

>I am running VC 4.0 patch one, on NT3.5.1.

>I have these CMDIWndChild derived frame classes that I dont the user to
>be able to change their size. How can I do this?

>About their title, I want to be able to set it, no tweaking by the
>frameworks.

Derive a new class from CMDIChild class, add exactly ONE override 
function:

  BOOL aChildFrame::PreCreateWindow(CREATESTRUCT& cs)
  { /* Turn OFF the following Window Styles */
    cs.style &= ~(WS_MAXIMIZEBOX |
                  WS_THICKFRAME |
                  FWS_ADDTOTITLE);
    return CMDIChildWnd::PreCreateWindow(cs);
  } // PreCreateWindow

Next, in your WinApp's InitInstance function:

  m_pDocTemplate = new CMultiDocTemplate(IDR_YOURTHINGY,
                                  RUNTIME_CLASS(CYourDoc),
                           note-->RUNTIME_CLASS(aChildFrame),
                                  RUNTIME_CLASS(CYourView));
  AddDocTemplate(m_pDocTemplate);

It's up to you to figure out precisely how to "pre-size" the CView to 
the proper dimensions during OnInitialUpdate().  You may also want to 
remove the system menu options to "Size" and "Maximize" menu items.
Add the following to your child view's OnInitialUpdate():

  /* Get the enclosing CMDIChildWnd frame pointer */
  CMDIChildWnd* pFrame = (CMDIChildWnd*)GetParent();
  /* Now obtain the menu handle */
  if (pFrame != NULL)
  { CMenu *pMenu = pFrame->GetSystemMenu(FALSE);

    /* Remove the Maximize and Size items */
    if (pMenu != NULL)
    { pMenu->RemoveMenu(SC_MAXIMIZE, MF_BYCOMMAND);
      pMenu->RemoveMenu(SC_SIZE, MF_BYCOMMAND);
    }
  }
___________________________________________________________________________
Mark F. Fling                                         mfling@stratacorp.com
Strata Corporation / SBA                               Voice (805) 967-3051
922 Via Brocha                                           Fax (805) 967-8203
Santa Barbara, CA  93110 





| Вернуться в корень Архива |