Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Remove close button from system menu
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Remove close button from system menu

 Post Reply Post Reply
Author
Message
Gonzo View Drop Down
Newbie
Newbie


Joined: 17 October 2007
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gonzo Quote  Post ReplyReply Direct Link To This Post Topic: Remove close button from system menu
    Posted: 07 January 2008 at 5:15pm
I am currently using Office2007 theme with

CXTPDialogBase<CXTResizeDialog> and CXTPOffice2007FrameHook

I am trying to get rid of the close button in the system menu which is usually done like this; however, this does not seem to work. Any suggestions?

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
        pSysMenu->RemoveMenu(SC_CLOSE,MF_BYCOMMAND);
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2008 at 1:50am

HI,

You can remove whole sysmenu : remove style WS_SYSMENU
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Gonzo View Drop Down
Newbie
Newbie


Joined: 17 October 2007
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gonzo Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2008 at 9:15am
Hi,

I don't want to remove the whole system menu. I would just like to disable or remove the close button.
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2008 at 3:11pm
Hi,
 
to disable you can set MF_DISABLED state for SC_CLOSE command.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Gonzo View Drop Down
Newbie
Newbie


Joined: 17 October 2007
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gonzo Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2008 at 7:20pm
Hi,

The above solution functions as long as I do not have "EnableOffice2007Frame(pCommandBars)" in my code. I would like to maintain this frame for my look and feel. Here is a little more code to debug the problem.

#define CDialogDlgBase CXTPDialogBase<CXTResizeDialog>

BOOL CMyApp::OnInitDialog()
{
    CDialogDlgBase::OnInitDialog();

    // Init the menus

    VERIFY(InitCommandBars());

    CXTPCommandBars* pCommandBars = GetCommandBars();

    LoadCommandBars(_T("CommandBars"));

    // Set the Office 2007 theme

    CXTPPaintManager::SetCustomTheme(new    CXTPOffice2007Theme());
    EnableOffice2007Frame(pCommandBars);
    pCommandBars->RedrawCommandBars();

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
        pSysMenu->EnableMenuItem(SC_CLOSE, MF_DISABLED);

     return TRUE;
}
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2008 at 11:51am
Hello,
It works for me.
Maybe your have older version and it was added after.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.055 seconds.