How to modify the System Menu to execute a function
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 9 of 9

Thread: How to modify the System Menu to execute a function

Threaded View

  1. #1
    Join Date
    May 2002

    How to modify the System Menu to execute a function

    I wish to add the item 'Website' to an MFC Dialog app System Menu so that it can activate the following method:
    void CMyDlg::OnWebpage() 
    	ShellExecute( NULL, NULL, _T(""), NULL, NULL, 0 );
    }// OnWebpage()
    I have tried this:
    #define IDM_WEBSITE  (WM_USER + 101)
    		if (!strAboutMenu.IsEmpty())
    			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    			pSysMenu->AppendMenuW(MF_STRING, IDM_WEBSITE, _T("Website"));
    void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
    	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
    		CAboutDlg dlgAbout;
    	else if ((nID & 0xFFF0) == IDM_WEBSITE)
    		CDialogEx::OnSysCommand(nID, lParam);
    The code compiles without error but and the 'website' item appears on the System Menu but it doesnt do anything.

    I've inspected the following but don't really understand how it works and it seems to me there should be a simpler way to accomplish my end.

    Modifying the System Menu By John Simmons 26 Jan 2007
    Any help appreciated.
    Last edited by Mike Pliam; February 11th, 2013 at 11:46 PM.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This a survey!

HTML5 Development Center