admin
2022-09-30 1a16b19acb23a4f28bafd01f3ed80fb225a96c3e
ConsoleApplication/THSActionUtil.cpp
@@ -541,6 +541,7 @@
   std::list<int*> dataItemList;
   for (int i = start_row;i < end_row;i++) {
      //TODO  100
      bool empty = ImgDivider::isRowEmpty(img, i, start_col, start_col + 50, 1, _IMG_BINARY_THRESHOLD) && ImgDivider::isRowEmpty(img, i, start_col + 50, start_col + 150, 2, _IMG_BINARY_THRESHOLD) && ImgDivider::isRowEmpty(img, i, start_col + (end_col - start_col) / 2 - 40, start_col + (end_col - start_col) / 2 + 40, 1, _IMG_BINARY_THRESHOLD);
      if (empty) {
         if (emptyStartRow < 0) {
@@ -667,7 +668,7 @@
      }
   }
   if (contentStartRow < 0|| contentStartRow>rows-100) {
   if (contentStartRow < 0 || contentStartRow>rows - 100) {
      throw string("起始行分隔出错(18)");
   }
@@ -1039,7 +1040,7 @@
   }
   contentEndRow = contentStartRow + 50;
   //分隔列
   list<int*> dataColIndexs;
   int startf = -1;
@@ -1286,11 +1287,11 @@
   }
   Sleep(200);
   addDialog = FindWindowExA(addDialog, NULL,"AfxWnd100s","CEFBrowser" );
   addDialog = FindWindowExA(addDialog, NULL, "AfxWnd100s", "CEFBrowser");
   addDialog = FindWindowExA(addDialog, NULL, "CefBrowserWindow", NULL);
   addDialog = FindWindowExA(addDialog, NULL, "Chrome_WidgetWin_0", NULL);
   addDialog = FindWindowExA(addDialog, NULL, "Chrome_RenderWidgetHostHWND", NULL);
   cout << "添加股票弹框:"<< addDialog << endl;
   cout << "添加股票弹框:" << addDialog << endl;
   Win32Util::focus(addDialog);
@@ -1422,7 +1423,7 @@
         lastBar = bar;
      }
      bar = FindWindowEx(hwnd, bar, TEXT("msctls_statusbar32"), NULL);
      if (count > 10|| bar<=0) {
      if (count > 10 || bar <= 0) {
         bar = 0;
         break;
      }
@@ -1447,7 +1448,7 @@
bool THSActionUtil::thsIsDead()
{
   cv::Mat oldMat= getTHSTimeCapture();
   cv::Mat oldMat = getTHSTimeCapture();
   Sleep(1200);
   cv::Mat newMat = getTHSTimeCapture();
@@ -1457,6 +1458,67 @@
   return FALSE;
}
void THSActionUtil::updateMainSite()
{
   //获取主页
   HWND main = getMainWin();
   if (main <= 0) {
      throw string("同花顺主页未打开");
   }
   Win32Util::showWindow(main);
   //获取toolbar
   HWND win = NULL;
   do {
      win = FindWindowExA(main, win, "AfxControlBar100s", "");
      if (win <= 0) {
         break;
      }
      RECT rect;
      GetWindowRect(win, &rect);
      if (rect.bottom - rect.top >= 40 && rect.bottom - rect.top <= 60) {
         break;
      }
   } while (true);
   if (win <= 0) {
      throw string("测速按钮未找到");
   }
   win = FindWindowExA(win, NULL, "#32770", "");
   if (win <= 0) {
      throw string("测速按钮未找到");
   }
   HWND btn = GetDlgItem(win, 0x00007A17);
   if (btn <= 0) {
      throw string("测速按钮未找到");
   }
   //点击按钮
   Win32Util::visualClick(btn, MAKELONG(3,3));
   for (int i = 0;i < 10;i++) {
      list<HWND> _list = Win32Util::searchWindow("选择最优行情主站");
      if (_list.size() > 0) {
         HWND win = *(_list.begin());
         HWND loginBtn = 0;
         for (int j = 0;j < 10;j++)
         {
            loginBtn =   FindWindowExA(win, NULL, "Button", "登 录");
            if (loginBtn > 0) {
               //点击登录按钮
               Win32Util::visualClick(loginBtn, MAKELONG(2, 2));
               break;
            }
            Sleep(200);
         }
      }
      Sleep(400);
   }
}
void THSActionUtil::clearPlateCodes(HWND hwnd)
{
   HWND content = FindWindowExA(hwnd, NULL, "AfxFrameOrView100s", NULL);