admin
2024-07-05 3ef188e6075649f4c72e3e7588d8966e1071f2ff
CBTrade/main.cpp
@@ -4,6 +4,8 @@
#include "MainFrame.h"
#include "MyConfigUtil.h"
class App :public wxApp {
@@ -14,14 +16,38 @@
   /// 初始化函数
   /// </summary>
   void InitData() {
      MyNetworkApi::set_server_info("43.138.167.68", 13008,"43.138.167.68", 13008);
      //MyNetworkApi::set_server_info("192.168.3.122", 13008, "192.168.3.122", 13008);
      MyNetworkApi::get_all_positions();
   }
   static void unhandled_exception_handler() {
      try {
         throw;  // Re-throw the exception to handle it
      }
      catch (const std::exception& e) {
         std::cerr << "Caught std::exception: " << e.what() << std::endl;
      }
      catch (...) {
         std::cerr << "Caught unknown exception" << std::endl;
      }
      std::abort();  // Terminate the program
   }
    bool OnInit() {
      std::set_terminate(unhandled_exception_handler);
      InitData();
      MainFrame* window = new MainFrame("可转债交易");
       SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
      MainFrame* window;
      WindowPosSize rect = MyConfigUtil::getMainWindowPos();
      cout << "获取到的坐标:" << rect.x << "  " << rect.y << endl;
      if (rect.x == -1 && rect.y == -1) {
         window = new MainFrame("可转债交易");
      }
      else {
         wxPoint   p = wxPoint(rect.x, rect.y);
         cout << "设置的坐标:" << p.x << "  " << p.y << endl;
         wxSize   s = wxSize(rect.width, rect.height);
         window = new MainFrame("可转债交易",p,s);
      }
      window->Show();
      return true;
   }