wxFrame * frame = NULL;
    EVT_MENU(XRCID("menu_mail"),   EmbedApp::OnMail)    EVT_MENU(XRCID("menu_chat"),   EmbedApp::OnChat)    EVT_MENU(XRCID("menu_editor"), EmbedApp::OnEditor)END_EVENT_TABLE()///////////////////////////////////////////////////////////////////////////////IMPLEMENT_APP(EmbedApp)bool EmbedApp::OnInit(){    wxImage::AddHandler(new wxGIFHandler);    wxXmlResource::Get()->InitAllHandlers();    InitXmlResource();    if (NS_FAILED(NS_InitEmbedding(nsnull, nsnull)))    {        return FALSE;    }    nsresult rv;    nsCOMPtr<nsIProfile> profileService =              do_GetService(NS_PROFILE_CONTRACTID, &rv);    rv = profileService->CreateNewProfile(L"wxEmbed", nsnull, nsnull, PR_FALSE);    if (NS_FAILED(rv)) return FALSE;    rv = profileService->SetCurrentProfile(L"wxEmbed");    if (NS_FAILED(rv)) return FALSE;    GeckoProtocolHandler::RegisterHandler("foo", "Test handler", new FooCallback);    // Register a window creator for popups    GeckoWindowCreator *creatorCallback = new GeckoWindowCreator();    if (creatorCallback)    {        nsCOMPtr<nsIWindowCreator> windowCreator(NS_STATIC_CAST(nsIWindowCreator *, creatorCallback));        if (windowCreator)        {            nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));            if (wwatch)            {                wwatch->SetWindowCreator(windowCreator);            }        }    }    // Create the main frame window    BrowserFrame* frame = new BrowserFrame(NULL);    frame->Show(TRUE);    SetTopWindow(frame);    return TRUE;}int EmbedApp::OnExit(){    // Shutdown the profile    nsresult rv;    nsCOMPtr<nsIProfile> profileService =              do_GetService(NS_PROFILE_CONTRACTID, &rv);    if (NS_SUCCEEDED(rv))    {        profileService->ShutDownCurrentProfile(nsIProfile::SHUTDOWN_PERSIST);     }    NS_TermEmbedding();    return 0;}void EmbedApp::OnQuit(wxCommandEvent & WXUNUSED(event)){    GetTopWindow()->Close(TRUE);}void EmbedApp::OnAbout(wxCommandEvent & WXUNUSED(event)){    (void)wxMessageBox(_T("wxEmbed"), _T("About wxEmbed"));}void EmbedApp::OnMail(wxCommandEvent & WXUNUSED(event)){    // Create the mail frame window    MailFrame * frame = (MailFrame *) wxWindow::FindWindowByName("mail", NULL);;    if (!frame)        frame = new MailFrame(NULL);    if (frame)        frame->Show(TRUE);}