• Console 应用程序中使用wxMessageBox


    注意生成控制台程序,即-L/SUBSYSTEM:console

     1 //This application demonstrates how to show a dialog in a console app.
     2 
     3 #include <wx/wx.h>
     4 
     5 #include <stdio.h>
     6 
     7 class MyApp : public wxApp
     8 {
     9 
    10 public:
    11     bool  OnInit ();
    12     int OnExit();
    13     int OnRun();
    14 
    15 };
    16 
    17 
    18 bool MyApp::OnInit()
    19 {
    20 
    21     return true;
    22 
    23 }
    24 int MyApp::OnExit()
    25 {
    26     return 0;
    27 }
    28 
    29 
    30 //all you want to do do it here:
    31 int MyApp::OnRun()
    32 {
    33     wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "program");
    34     printf("This is a line of text from console.
    ");
    35     wxPrintf("Press any key to show a dialog..
    ");
    36     system("pause");
    37 
    38     wxMessageBox(wxT("This is a window."));
    39 
    40     wxPrintf("Press any key to continue...
    ");
    41     system("pause");
    42 
    43     wxPrintf("This is a line of text from console using wxPrintf
    ");
    44     system("pause");
    45     return 0;
    46 }
    47 int main(int argc,char* argv[])
    48 {
    49     wxInitializer init;
    50     if(!init)
    51     {
    52         fprintf(stderr,"failed to init wx.abort.
    ");
    53         return -1;
    54     }
    55     MyApp* app=new MyApp();
    56 
    57     wxApp::SetInstance(app);
    58 
    59     //nothing need to write here.
    60 
    61 
    62     return wxEntry(argc,argv);
    63 
    64 }
  • 相关阅读:
    django core cache 永不失效配置
    zabbix-ODBC-oracle
    time
    zabbix中的触发器依赖
    Servlet1
    每周总结01
    使用IntelliJ IDEA集成TomCat
    hadoop环境配置
    《软件工程》学习进度条博客16
    03梦断代码读后感3
  • 原文地址:https://www.cnblogs.com/godspeedsam/p/3854067.html
Copyright © 2020-2023  润新知