zoukankan      html  css  js  c++  java
  • 01

    1. preprocessor

    #define __WXMSW__
    #define WXUSINGDLL

    2. vc10中设置Include dir, lib dir, dll path

    VC++平台编译完的lib 和DLL都在这个目录下 C:ProgramswxWidgets-3.0.0libvc_dll

    3. HelloWorld源代码

     1 // wxWidgets "Hello world" Program
     2 // For compilers that support precompilation, includes "wx/wx.h".
     3 #define __WXMSW__
     4 #define WXUSINGDLL
     5 #include <wx/wx.h>
     6 
     7 class MyApp: public wxApp
     8 {
     9 public:
    10 virtual bool OnInit();
    11 };
    12 class MyFrame: public wxFrame
    13 {
    14 public:
    15 MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
    16 private:
    17 void OnHello(wxCommandEvent& event);
    18 void OnExit(wxCommandEvent& event);
    19 void OnAbout(wxCommandEvent& event);
    20 wxDECLARE_EVENT_TABLE();
    21 };
    22 enum
    23 {
    24 ID_Hello = 1
    25 };
    26 wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
    27 EVT_MENU(ID_Hello, MyFrame::OnHello)
    28 EVT_MENU(wxID_EXIT, MyFrame::OnExit)
    29 EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
    30 wxEND_EVENT_TABLE()
    31 wxIMPLEMENT_APP(MyApp);
    32 bool MyApp::OnInit()
    33 {
    34 MyFrame *frame = new MyFrame( "Hello World", wxPoint(50, 50), wxSize(450, 340) );
    35 frame->Show( true );
    36 return true;
    37 }
    38 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
    39 : wxFrame(NULL, wxID_ANY, title, pos, size)
    40 {
    41 wxMenu *menuFile = new wxMenu;
    42 menuFile->Append(ID_Hello, "&Hello...	Ctrl-H",
    43 "Help string shown in status bar for this menu item");
    44 menuFile->AppendSeparator();
    45 menuFile->Append(wxID_EXIT);
    46 wxMenu *menuHelp = new wxMenu;
    47 menuHelp->Append(wxID_ABOUT);
    48 wxMenuBar *menuBar = new wxMenuBar;
    49 menuBar->Append( menuFile, "&File" );
    50 menuBar->Append( menuHelp, "&Help" );
    51 SetMenuBar( menuBar );
    52 CreateStatusBar();
    53 SetStatusText( "Welcome to wxWidgets!" );
    54 }
    55 void MyFrame::OnExit(wxCommandEvent& event)
    56 {
    57 Close( true );
    58 }
    59 void MyFrame::OnAbout(wxCommandEvent& event)
    60 {
    61 wxMessageBox( "This is a wxWidgets' Hello world sample",
    62 "About Hello World", wxOK | wxICON_INFORMATION );
    63 }
    64 void MyFrame::OnHello(wxCommandEvent& event)
    65 {
    66 wxLogMessage("Hello world from wxWidgets!");
    67 }

    第一个程序很简单,应该不会出什么错误.

  • 相关阅读:
    WinRAR5.01注册码附注册机
    PS不能存储,因为程序错误
    mysql中 date datetime time timestamp 的区别
    sublime text 3 3126 注册码+中文包
    IIS7.5 用 IIS AppPool应用程序池名 做账号 将各站点权限分开
    linux vi 报错 E37: No write since last change (add ! to override)
    Linux 安装 apache2.4.23
    三级分类及名称及列表
    二级栏目名称及列表
    每隔N行输出不同样式
  • 原文地址:https://www.cnblogs.com/xzpp/p/3590541.html
Copyright © 2011-2022 走看看