How to add "About..." menu item in system menu or handle windows specific events?

Printer-friendly versionPDF versionIn the dialog wxInitDialogEvent event handler function or the wxFrame constructor add the following lines:
    // Add about option to system menu
    HMENU hSystemMenu = ::GetSystemMenu(GetHwnd(),FALSE);
    ::AppendMenu(hSystemMenu,MF_SEPARATOR,0,wxT(""));
    ::AppendMenu(hSystemMenu,MF_STRING,IDM_ABOUT,wxT("About..."));
    ::DrawMenuBar(GetHwnd());
In the dialog or frame header file add the following unused identifier for IDM_ABOUT: #define IDM_ABOUT wxID_HIGHEST // System menu "About..." ID In your main application window, whether frame or dialog, add the following function:
    // Override MSWWindowProc to respond to system menu "About..." selection
    bool MSWTranslateMessage(WXMSG* pMsg);
In the function definition, you can handle the WM_SYSCOMMAND as:
bool MainDlg::MSWTranslateMessage(WXMSG* pMsg)
{
    if ((pMsg->message == WM_SYSCOMMAND) && (pMsg->wParam == IDM_ABOUT))
    {
        wxAboutDialogInfo aboutDlgInfo;

        aboutDlgInfo.SetName(wxT("My Application"));
        aboutDlgInfo.SetVersion(wxT("1.00"));
        ...
        wxAboutBox(aboutDlgInfo);
        return true; // Message processed
    }
    else
        return wxDialog::MSWTranslateMessage(pMsg);
}
Or you can also send a custom wxEvent back to the application rather than calling wxAboutBox in MSWTranslate message.