CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Location
    UK (South)
    Posts
    93

    How Do I Disable Close Window X?



    I have a CToolBar which when dragged from its docking position, becomes a window.


    It displayes that little cross 'fella' in the corner to close it.


    I want to disable this. I had assumed that I could create it without one but I dont know how. I notice in Visual studio the toolbar close facilty (X) is disable How do I do that?




  2. #2
    Join Date
    May 1999
    Location
    Republic of Korea
    Posts
    100

    Re: How Do I Disable Close Window X?

    Try following.
    First, get system menu from floating window,
    then disable close button.

    Here is a tiny code and they work for all windows with system menu.

    CMenu *pSysMenu = (CMenu*)pMiniFrame->GetSystemMenu(FALSE);
    pSysMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);

    Good Luck.
    Walter I An



  3. #3
    Join Date
    May 1999
    Location
    UK (South)
    Posts
    93

    Re: How Do I Disable Close Window X?

    CMenu *pSysMenu = (CMenu*) (&m_wndToolBar2)->GetSystemMenu(FALSE);
    pSysMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);

    This creates an exception. Probably because the window is not originally created as floating. So it doesnot have a system menu. How do I only call this once the window floats?

    In otherwords what message can I capture that tells me when the window is made to float.

    Simon Pettman


  4. #4
    Join Date
    Apr 1999
    Posts
    2

    Re: How Do I Disable Close Window X?

    Hi
    You can see the answer at CodeGuru Home Page.
    In Home Page, there is title "Other Source Code Section". Select "dialog". And then search the title "Menu Handling". Under "Menu Handling" there is a subject "Disable close button for Dialog Box" by Rajesh Rarikh. You can study and enjoy.
    AntHtoo Naing


  5. #5
    Join Date
    May 1999
    Location
    Republic of Korea
    Posts
    100

    Re: How Do I Disable Close Window X?

    U are right!
    U need to check this when Ur window is not docked.

    There is a function called "IsFloating()"
    in CControlBar.

    Good luck.

    Walter An


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured