//wxWidgets"Hello world"Program//Forcompilersthatsupportprecompilation,includes"wx/wx.h".#include <wx/wxprec.h>#ifndef WX_PRECOMP#include <wx/wx.h>#endifclassMyApp:publicwxApp{public:virtualboolOnInit();};classMyFrame:publicwxFrame{public:MyFrame(constwxString&title,constwxPoint&pos,constwxSize&size);private:voidOnHello(wxCommandEvent&event);voidOnExit(wxCommandEvent&event);voidOnAbout(wxCommandEvent&event);wxDECLARE_EVENT_TABLE();};enum{ID_Hello=1};wxBEGIN_EVENT_TABLE(MyFrame,wxFrame)EVT_MENU(ID_Hello,MyFrame::OnHello)EVT_MENU(wxID_EXIT,MyFrame::OnExit)EVT_MENU(wxID_ABOUT,MyFrame::OnAbout)wxEND_EVENT_TABLE()wxIMPLEMENT_APP(MyApp);boolMyApp::OnInit(){MyFrame*frame=newMyFrame("Hello World",wxPoint(50,50),wxSize(450,340));frame->Show(true);returntrue;}MyFrame::MyFrame(constwxString&title,constwxPoint&pos,constwxSize&size):wxFrame(NULL,wxID_ANY,title,pos,size){wxMenu*menuFile=newwxMenu;menuFile->Append(ID_Hello,"&Hello...\tCtrl-H","Help string shown in status bar for this menu item");menuFile->AppendSeparator();menuFile->Append(wxID_EXIT);wxMenu*menuHelp=newwxMenu;menuHelp->Append(wxID_ABOUT);wxMenuBar*menuBar=newwxMenuBar;menuBar->Append(menuFile,"&File");menuBar->Append(menuHelp,"&Help");SetMenuBar(menuBar);CreateStatusBar();SetStatusText("Welcome to wxWidgets!");}voidMyFrame::OnExit(wxCommandEvent&event){Close(true);}voidMyFrame::OnAbout(wxCommandEvent&event){wxMessageBox("This is a wxWidgets' Hello world sample","About Hello World",wxOK|wxICON_INFORMATION);}voidMyFrame::OnHello(wxCommandEvent&event){wxLogMessage("Hello world from wxWidgets!");}