admin
2023-03-07 8b06b1cbf112d55307ea8a6efe711db4e7506d89
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
#pragma once
#include <map>
#include <wtypes.h>
#include <set>
#include "TradeQueueCapture.h"
#include "Win32Util.h"
typedef void (*CallbackFun_Trade_Queue_New)(int index, TradeQueueResult result, void* contex);
// ½»Ò×¶ÓÁнØÍ¼Ê¶±ð¹ÜÀíÆ÷
class TradeQueueCaptureManager
{
private:
    static bool inited;
    const static int MAX_COUNT = 10;
    static HWND hwnds[MAX_COUNT];
    static TradeQueueCapture* captures[MAX_COUNT];
    static CallbackFun_Trade_Queue_New data_callback;
    static bool running;
    static void* context;
    static void _run(int index);
    static bool tradeTimeCapture;
    // ¼ÓÔØ½»Ò×´°¿ÚµÄHWND
    static void loadTradeWinsHWND();
 
    static bool hwnd_compare(HWND h1, HWND h2) {
        RECT rect1;
        RECT rect2;
        Win32Util::getWindowRect(h1,&rect1);
        Win32Util::getWindowRect(h2, &rect2);
 
        if (rect1.top == rect2.top) {
            return rect1.left < rect2.left;
        }
        // °´ÕÕÉýÐò
        return rect1.top < rect2.top;
    }
 
 
public:
    
    //³õʼ»¯
    static void init(CallbackFun_Trade_Queue_New trade_queue_callback, void* context);
 
    //ÉèÖý»Ò×ʱ¼ä½ØÍ¼ÉÏ´«Êý¾Ý
    static void setTradeTimeCapture(bool enable) {
        tradeTimeCapture = enable;
    }
 
    static void refreshHWND();
 
    //È«²¿¿ªÊ¼
    static void start();
 
    //È«²¿½áÊø
    static void stop();
 
    static bool isRunning();
 
    //ÊÇ·ñ³õʼ»¯
    static bool isInited();
 
 
 
};