| | |
| | | #include <set> |
| | | #include "Win32Util.h" |
| | | #include "TaskChecker.h" |
| | | #include "GPUtil.h" |
| | | |
| | | bool CurrentPriceCapture::tradeTimeCapture; |
| | | OpenCLExcuter* CurrentPriceCapture::openCLExcuter; |
| | | bool CurrentPriceCapture::inited; |
| | | //是否正在执行 |
| | |
| | | while (true) { |
| | | if (kill) |
| | | break; |
| | | if (tradeTimeCapture) { |
| | | if (!GPUtil::isPreTradeTime()) { |
| | | Sleep(100); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | TaskChecker::clientLiveTime.limitUp = clock(); |
| | | if (running && inited) { |
| | | clock_t start = clock(); |
| | |
| | | rt.detach(); |
| | | } |
| | | void CurrentPriceCapture::refreshHWND() { |
| | | HWND hwnd = THSActionUtil::getMainWin(); |
| | | HWND hwnd = THSActionUtil::getSecondWindow(); |
| | | if (hwnd <= 0) |
| | | throw string("同花顺主屏未打开"); |
| | | throw string("同花顺副屏1未打开"); |
| | | |
| | | //采用快捷键打开 |
| | | Win32Util::focus(hwnd); |
| | | //Win32Util::keyboardNum("51", 200); |
| | | //Win32Util::keyboard(VK_RETURN, 10); |
| | | Win32Util::keyboardNum("51", 200); |
| | | Win32Util::keyboard(VK_RETURN, 10); |
| | | Sleep(1000); |
| | | |
| | | |
| | |
| | | return running; |
| | | } |
| | | |
| | | list<CurrentPriceData> CurrentPriceCapture::capture(cv::Mat oimg) { |
| | | list<CurrentPriceData> CurrentPriceCapture::capture(cv::Mat oimg, OpenCLExcuter* openCLExcuter) { |
| | | cv::Mat grayImg = cv::Mat::zeros(oimg.rows, oimg.cols, CV_8UC1);//ImgUtil::grayImage(oimg); |
| | | |
| | | uchar* imgData = (uchar*)malloc(sizeof(uchar) * oimg.rows * oimg.cols); |
| | |
| | | } |
| | | int x = wrect.right - 50; |
| | | int y = wrect.top + 50; |
| | | SendMessage(win, WM_MOUSEWHEEL, 0, MAKEWORD(x, y)); |
| | | Sleep(100); |
| | | PostMessage(win, WM_MOUSEWHEEL, 0, MAKEWORD(x, y)); |
| | | Sleep(200); |
| | | cv::Mat oimg = CaptureUtil::capture(win); |
| | | list<CurrentPriceData> codes = capture(oimg); |
| | | list<CurrentPriceData> codes = capture(oimg,openCLExcuter); |
| | | for (list<CurrentPriceData>::iterator ele = codes.begin();ele != codes.end();ele++) { |
| | | string code = (*ele).code; |
| | | if (codesSet.count(code) == 0&&stof((*ele).price)>0) { |
| | |
| | | codes.clear(); |
| | | Sleep(50); |
| | | } |
| | | |
| | | |
| | | |
| | | return flist; |
| | | |
| | | } |
| | | |
| | | //全部开始 |