rendered paste body//################# test.h #####################include <wx/wx.h>DECLARE_EVENT_TYPE(MY_CUSTOM_EVENT_START, -1)class CMyApp : public wxApp{public: void OnStart(wxCommandEvent& f_event); bool OnInit();private: wxFrame* m_frame_p; wxStaticText* m_text_p; DECLARE_EVENT_TABLE()};//################# test.cpp #####################include <wx/evtloop.h>#include <sstream>#include "test.h"IMPLEMENT_APP(CMyApp)DEFINE_EVENT_TYPE(MY_CUSTOM_EVENT_START)BEGIN_EVENT_TABLE(CMyApp, wxApp) EVT_COMMAND(wxID_ANY, MY_CUSTOM_EVENT_START, CMyApp::OnStart)END_EVENT_TABLE()boolCMyApp::OnInit(){ wxCommandEvent event( MY_CUSTOM_EVENT_START ); wxPostEvent(wxTheApp, event); m_frame_p = new wxFrame(NULL, wxID_ANY, wxT("Test application")); m_text_p = new wxStaticText(m_frame_p, wxID_ANY, wxT("Text")); return true;}voidCMyApp::OnStart(wxCommandEvent& f_event){ m_frame_p->Show(); int i = 0; wxEventLoop* l_loop = wxEventLoop::GetActive(); while (true) { std::stringstream l_str; l_str << i++; m_text_p->SetLabel(wxConvertMB2WX(l_str.str().c_str())); while (l_loop->Pending()) { l_loop->Dispatch(); } }}// compile with:// g++ `wx-config --cxxflags --libs` test.cpp -o test