So... here's what you do... in your dialog's "Create" method (or some other reasonable location), add the following:
Code: Select all
// Add about option to system menu
HMENU hSystemMenu = ::GetSystemMenu((HWND__ *) GetHWND(),FALSE);
::AppendMenu(hSystemMenu,MF_SEPARATOR,0,"");
::AppendMenu(hSystemMenu,MF_STRING,IDM_ABOUT,"About...");
::DrawMenuBar((HWND__ *) GetHWND());
Code: Select all
#define IDM_ABOUT 10099 // System menu "About..." ID
Code: Select all
[rest of class definition, MainDlg in this example]
.
.
// Override MSWTranslateMessage to respond to system menu "About..." selection
bool MSWTranslateMessage(WXMSG* pMsg);
Code: Select all
bool MainDlg::MSWTranslateMessage(WXMSG* pMsg)
{
if ( (pMsg->message == WM_SYSCOMMAND) && (pMsg->wParam == IDM_ABOUT))
{
wxAboutDialogInfo di;
di.SetName("My App");
di.SetVersion("1.00");
di.SetDescription("This app does cool trix!");
... etc ...
wxAboutBox(di);
return true; // Message processed
}
else
return wxDialog::MSWTranslateMessage(pMsg);
}
That's it! Run you application, and you'll now have a system menu "About..." choice that displays an about box.
The preceding code can also be used on a more tradiational frame-based application -- you just replace "wxDialog" with "wxFrame" above.
QUESTION (for those more experienced than me): Would it be better to send a custom event back to the app rather than calling wxAboutBox in MSWTranslate message?
---Joel