admin
8 天以前 6cd92a169cbc0db35042f243a09d976fd3e1445c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include "common/pch.h"
#include "ThsUtil.h"
#include "../common/Win32Util.h"
#include "ConfigUtil.h"
 
HWND ThsUtil::get_trade_refesh_hwnd()
{
    list<HWND>  hwnds = Win32Util::searchWindow("ÍøÉÏ¹ÉÆ±½»Ò×ϵͳ");
    if (hwnds.size() <= 0) {
        return 0;
    }
 
    for (list<HWND>::iterator el = hwnds.begin(); el != hwnds.end(); el++) {
        HWND hwnd = *el;
        HWND content_hwnd = FindWindowEx(hwnd, NULL, L"AfxMDIFrame140s", NULL);
        HWND   temp = FindWindowEx(content_hwnd, NULL, L"#32770", NULL);
        for (int i = 0; i < 10; i++) {
 
            if (Win32Util::isWindowShow(temp)) {
                break;
            }
            temp = FindWindowEx(content_hwnd, temp, L"#32770", NULL);
        }
        if (!temp)
            continue;
        HWND t1 = FindWindowEx(temp, NULL, NULL, L"¹ýÂË");
        if (!Win32Util::isWindowShow(t1))
            continue;
 
        HWND tool_hwnd = FindWindowEx(hwnd, NULL, L"ToolbarWindow32", NULL);
        temp = FindWindowEx(tool_hwnd, NULL, L"#32770", NULL);
        if (temp) {
            HWND    nq = FindWindowEx(temp, NULL, NULL, L"ÄÚǶ");
            if (nq && Win32Util::isWindowShow(nq))
                continue;
            return tool_hwnd;
        }
    }
    return 0;
}
 
HWND ThsUtil::get_ths_second_screen_menu_hwnd()
{
    list<HWND>  hwnds = Win32Util::searchWindow("¸±ÆÁ1");
    if (hwnds.size() > 0) {
        HWND hwnd =* hwnds.begin();
        hwnd = FindWindowEx(hwnd, NULL, L"AfxFrameOrView100s", NULL);
        HWND temp=0 ;
        for (int i = 0; i < 100; i++) {
            temp = FindWindowEx(hwnd, temp, L"AfxWnd100s", NULL);
            if (Win32Util::isWindowShow(temp)) {
                RECT rect;
                Win32Util::getWindowRect(temp, &rect);
                if (rect.bottom - rect.top > rect.right - rect.left)
                    break;
            }
        }
        if (temp <= 0)
            return 0;
        hwnd = temp;
        hwnd = FindWindowEx(hwnd, NULL, L"#32770", NULL);
        hwnd = FindWindowEx(hwnd, NULL, L"block_list_page", NULL);
        if (hwnd > 0)
            return hwnd;
    }
    return 0;
}
 
void ThsUtil::run_trade_refresh()
{
    HWND hwnd = get_trade_refesh_hwnd();
    int    count = 0;
    while (TRUE) {
        count += 1;
        if (count > 10) {
            count = 0;
            hwnd = get_trade_refesh_hwnd();
        }
        try {
            if (hwnd <= 0) {
                Sleep(20);
                continue;
            }
            // ²âÊÔ
            if (!ConfigUtil::isTradeRefresh())
            {
                Sleep(20);
                continue;
            }
            RECT    rect;
            Win32Util::getWindowRect(hwnd, &rect);
            Win32Util::visualClick(hwnd, MAKELONG(210, (rect.bottom - rect.top) / 2));
            //Win32Util::visualClick(hwnd, MAKELONG(180,(rect.bottom - rect.top) / 2));
            int time_space = ConfigUtil::getThsAutoRefreshTimeSpace();
            if (time_space <= 0) {
                time_space = 500;
            }
            Sleep(time_space);
        }
        catch (...) {
 
        }
        Sleep(20);
    }
}
 
HWND ThsUtil::get_ths_flash_sell_win()
{
    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;
            }
        }
        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;
}