| | |
| | | clock_t start = clock(); |
| | | try { |
| | | list<TradeSuccessData> datas = captureTradeSuccessInfo(); |
| | | cout << "耗时:" << clock() - start << " 数量:" << datas.size() << endl; |
| | | //cout << "耗时:" << clock() - start << " 数量:" << datas.size() << endl; |
| | | data_callback_success(datas, context); |
| | | datas.clear(); |
| | | } |
| | |
| | | try { |
| | | list<TradeDelegateData> datas = captureSimpleTradeDelegateInfo(); |
| | | string money = getSimpleAvaiableMoney(); |
| | | cout << "耗时:" << clock() - start << " 数量:" << datas.size() << endl; |
| | | //cout << "耗时:" << clock() - start << " 数量:" << datas.size() << endl; |
| | | data_callback_delegate(datas, money, context); |
| | | datas.clear(); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | } |
| | | void TradeListCapture::selectTradeSimpleDelegate(MatOcrFun matMcrFun) |
| | | { |
| | | try { |
| | | //刷新窗口 |
| | | refreshTradeSimpleDelegateHWND(); |
| | | } |
| | | catch (...) { |
| | | |
| | | } |
| | | HWND win = THSActionUtil::getTradeSimpleDelegateWindow(); |
| | | HWND menuWin = TradeListCapture::getSimpleTradeLeftMenu(win); |
| | | if (menuWin > 0) { |
| | | cv::Mat img = CaptureUtil::capture(menuWin); |
| | | cv::Mat grayImg = ImgUtil::grayImage(img); |
| | | img.release(); |
| | | list<OCRResult> resultList = matMcrFun("当日委托", grayImg); |
| | | if (resultList.size() > 0) { |
| | | OCRResult result = *(resultList.begin()); |
| | | RECT menuWinRect; |
| | | Win32Util::getWindowRect(menuWin, &menuWinRect); |
| | | int x = menuWinRect.left + result.rect.left + (result.rect.right - result.rect.left) / 2; |
| | | int y = menuWinRect.top + result.rect.top + (result.rect.bottom - result.rect.top) / 2; |
| | | //点击 |
| | | Win32Util::click(x, y, 10); |
| | | } |
| | | } |
| | | } |
| | | void TradeListCapture::selectTradeSuccess(MatOcrFun matMcrFun) |
| | | { |
| | | try { |
| | | //刷新窗口 |
| | | refreshTradeSuccessHWND(); |
| | | } |
| | | catch (...) { |
| | | |
| | | } |
| | | HWND win = THSActionUtil::getTradeSuccessWindow(); |
| | | HWND menuWin = TradeListCapture::getSimpleTradeLeftMenu(win); |
| | | if (menuWin > 0) { |
| | | cv::Mat img = CaptureUtil::capture(menuWin); |
| | | cv::Mat grayImg = ImgUtil::grayImage(img); |
| | | img.release(); |
| | | list<OCRResult> resultList = matMcrFun("当日成交", grayImg); |
| | | if (resultList.size() > 0) { |
| | | OCRResult result = *(resultList.begin()); |
| | | RECT menuWinRect; |
| | | Win32Util::getWindowRect(menuWin, &menuWinRect); |
| | | int x = menuWinRect.left + result.rect.left + (result.rect.right - result.rect.left) / 2; |
| | | int y = menuWinRect.top + result.rect.top + (result.rect.bottom - result.rect.top) / 2; |
| | | //点击 |
| | | Win32Util::click(x, y, 10); |
| | | } |
| | | } |
| | | } |
| | | void TradeListCapture::reCreateTradeSuccessRunning() |
| | | { |
| | |
| | | std::advance(end, -1); |
| | | int end_start = (*end)[0]; |
| | | std::advance(end, -1); |
| | | if (end_start - (*end)[1]>15) { |
| | | if (end_start - (*end)[1] > 15) { |
| | | //删除最后1条数据 |
| | | std::advance(end, 1); |
| | | free(*end); |