From 8ea6d363df77de2dca288397da8d4f9c3d3a5c4d Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 18 十月 2024 18:41:57 +0800 Subject: [PATCH] '项目完善' --- FloatTrade/ThsUtil.cpp | 67 +++++++++++++++------------------ 1 files changed, 31 insertions(+), 36 deletions(-) diff --git a/FloatTrade/ThsUtil.cpp b/FloatTrade/ThsUtil.cpp index 2ba35b4..518b0f0 100644 --- a/FloatTrade/ThsUtil.cpp +++ b/FloatTrade/ThsUtil.cpp @@ -104,45 +104,40 @@ } } -void ThsUtil::run_group_refresh() +HWND ThsUtil::get_ths_flash_sell_win() { - HWND hwnd = get_ths_second_screen_menu_hwnd(); - while (TRUE) { - try { - if (hwnd <= 0 || !Win32Util::isWindowShow(hwnd)) - // print("未找到同花顺副屏句柄") - hwnd = get_ths_second_screen_menu_hwnd(); - - if (hwnd <= 0) { - Sleep(20); - continue; - } - if (!ConfigUtil::isGroupRefresh()) { - Sleep(20); - continue; - } - - list<POINT> posList = ConfigUtil::getThsAutoClickPositions(); - if (posList.size() < 1) { - Sleep(20); - continue; - } - - int space = ConfigUtil::getThsAutoClickTimeSpace(); - if (space <= 0) - space = 500; - for (list<POINT>::iterator el = posList.begin(); el != posList.end(); el++) { - POINT p= *el; - Win32Util::visualClick(hwnd, MAKELONG(p.x,p.y)); - Sleep(space); - } + auto hwnd = GetDesktopWindow(); + HWND mainPage = HWND(); + //获取桌面子窗口句柄 + hwnd = GetWindow(hwnd, GW_CHILD); + list<HWND> list; + while (hwnd != NULL) + { + const int bufferSize = 256; + TCHAR className[bufferSize]; + GetClassName(hwnd, className, bufferSize); + if (CString(className).Find( L"#32770")==0) { + if (FindWindowEx(hwnd, NULL, NULL, L"一键卖出[S]") >0) { + return hwnd; } - catch (...) { - - } - - Sleep(20); } + hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); + } + return HWND(); } + +std::wstring ThsUtil::get_ths_flash_sell_name() +{ + HWND hwnd = get_ths_flash_sell_win(); + if (hwnd <= 0) { + return L""; + } + HWND nameHWND = GetDlgItem(hwnd, 0x0000040C); + std::wstring name = Win32Util::getText(nameHWND); + return name; +} + + + -- Gitblit v1.8.0