Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / My application is closing right away - need help!

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. My application is closing right away - need help!
#5153
Posted by: 2004-09-28 23:39:11
Hi! I`ve just started using wxWidgets, and today, I tried to write my own little application. When I finaly got my application compiled whith no errors and I tried to run the program, I didn`t even se any sign of a program running. I`ve tried many different things, but with no positive result.
I use Dev C++ version 4.9.9.0.
Here`s my source code:
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

class MyTest: public wxFrame {
public:
    /***
     *Interface
     ***************************/    
    //Constructor - Declarations
    MyTest(wxChar* title, int xpos, int ypos, int width, int height);
    //Ordinary functions:
    bool OnInit();
    //Destructor - Declaration
    ~MyTest();
private:
    /***
     *Implementation
     **************************/
};


MyTest::MyTest(wxChar* title, int xpos, int ypos, int width, int height)
:wxFrame((wxFrame *) NULL, -1, title, wxPoint(xpos, ypos), wxSize(width, height))
{
}

bool MyTest::OnInit()
{
    MyTest *frame = new MyTest("MyTest", 100, 100, 500, 500);
    frame->CreateStatusBar();
    frame->SetStatusText(wxNow());
    frame->Show(true);
    return true;
}

MyTest::~MyTest() { }
   
       
PS: I`ve tried to search the forum and the web, but whith no result.
Message2. Re: My application is closing right away - need help!
#5168
Posted by: idb 2004-09-30 23:46:43

// Windows 2000, Dev-Cpp 4.9.8.9, GCC 3.2
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

class MyApp : public wxApp{
public:
    virtual bool OnInit();
};

class MyTest: public wxFrame {
public:
    MyTest(const wxString& title, const wxPoint& pos, const wxSize& size,
            long style = wxDEFAULT_FRAME_STYLE);
    ~MyTest(){}
private:
};
//start
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(){
    MyTest *frame = new MyTest(_T("MyTest"), wxPoint(100, 100), wxSize(500, 500));
    frame->CreateStatusBar();
    frame->SetStatusText(wxNow());
    frame->Show(true);
    return TRUE;
}
MyTest::MyTest(const wxString& title, const wxPoint& pos, const wxSize& size, long style)
       : wxFrame(NULL, -1, title, pos, size, style){
};

/*
PS:
 go to http://home.tiscali.be/franky.braem17/wxwindows.htm,
ang get wxTutorial.zip & wxTutorial.pdf
*/
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0