admin
2022-09-09 60feedf43a35a9ca69d05095a01c5d1797b1bdc3
ConsoleApplication/THSActionUtil.cpp
@@ -524,7 +524,7 @@
         //关闭按钮
         Sleep(100);
         HWND close = FindWindowA(0, "添加股票");
         SendMessage(close, WM_CLOSE, 0, 0);
         PostMessage(close, WM_CLOSE, 0, 0);
         break;
      }
   }
@@ -667,7 +667,7 @@
      }
   }
   if (contentStartRow < 0) {
   if (contentStartRow < 0|| contentStartRow>rows-100) {
      throw string("起始行分隔出错(18)");
   }
@@ -1402,7 +1402,62 @@
   return fresultList;
}void THSActionUtil::clearPlateCodes(HWND hwnd)
}
cv::Mat getTHSTimeCapture() {
   HWND hwnd = THSActionUtil::getMainWin();
   if (hwnd <= 0) {
      throw string("未找到同花顺主页");
   }
   HWND bar = FindWindowEx(hwnd, NULL, TEXT("msctls_statusbar32"), NULL);
   int count = 0;
   int lastTop = 0;
   HWND lastBar = 0;
   do {
      count++;
      RECT rect;
      GetWindowRect(bar, &rect);
      if (rect.top > lastTop) {
         lastTop = rect.top;
         lastBar = bar;
      }
      bar = FindWindowEx(hwnd, bar, TEXT("msctls_statusbar32"), NULL);
      if (count > 10|| bar<=0) {
         bar = 0;
         break;
      }
   } while (TRUE);
   if (lastBar <= 0) {
      throw string("未找到同花顺时间窗口");
   }
   if (lastBar > 0) {
      cv::Mat  mat = CaptureUtil::capture(lastBar);
      if (mat.cols > 100) {
         mat = cv::Mat(mat, cv::Rect(mat.cols - 80, 0, 80, mat.rows));
         mat = ImgUtil::grayImage(mat);
         return mat;
      }
   }
   throw string("未找到同花顺时间截图获取失败");
}
bool THSActionUtil::thsIsDead()
{
   cv::Mat oldMat= getTHSTimeCapture();
   Sleep(1200);
   cv::Mat newMat = getTHSTimeCapture();
   if (ImgUtil::isImgSame(oldMat, newMat)) {
      return TRUE;
   }
   return FALSE;
}
void THSActionUtil::clearPlateCodes(HWND hwnd)
{
   HWND content = FindWindowExA(hwnd, NULL, "AfxFrameOrView100s", NULL);
   for (int i = 0;i < 15;i++)
@@ -1545,7 +1600,7 @@
void THSActionUtil::addTargetCodes(list<std::string> codeList, RecognitionManager* recognitionManager)
{
   //获取同花顺主页
   HWND win = getMainWin();
   HWND win = getSecondWindow();
   Win32Util::focus(win);
   //快捷键打开板块
   Win32Util::keyboardNum("51", 200);