Esempio n. 1
0
 def init_hwnd(self):
     self.__top_hwnd = findTopWindow(wantedClass='TdxW_MainFrame_Class')
     self.__button = {'refresh': 180, 'position': 145, 'deal': 112, 'withdrawal': 83, 'sell': 50, 'buy': 20}
     windows = dumpWindows(self.__top_hwnd)
     if self.debug: print('windows=',windows)
     temp_hwnd = 0
     temp_hwnd_guanlian=0
     p_hwnd=0
     self.p_acc_hwnd = 0
     self.acc_hwnd = 0
     self.new_stock_order_hwnd = 0
     find_guan_lian = False
     find_new_stock = False
     find_combobox = False
     for window in windows:
         child_hwnd, window_text, window_class = window
         if window_text=='买卖关联同一支股票':
             temp_hwnd_guanlian = child_hwnd
             print("find the hwnd: 买卖关联同一支股票, ",temp_hwnd_guanlian)
         if window_class == 'MHPToolBar' and window_text=='MainViewBar':
             self.p_acc_hwnd = child_hwnd
             print('parent_acc_combobox_hwnd=',self.p_acc_hwnd)
             p_p_acc_hwnd=getParentWindow(self.p_acc_hwnd)
             acc_windows = dumpWindows(self.p_acc_hwnd)   
             for window in acc_windows:
                 child_hwnd, window_text, window_class = window
                 if window_class == 'ComboBox':
                     self.acc_hwnd = child_hwnd
                     find_combobox = True
                     print('acc_combobox_hwnd=',self.acc_hwnd)
         if window_text=='一键申购':
             self.new_stock_order_hwnd = child_hwnd
             find_new_stock = True
         if find_guan_lian and find_new_stock and find_combobox:
             break
     else:
         pass  
         #raise Exception("Change saving type failed") 
                 
     if temp_hwnd_guanlian:
         p_hwnd=getParentWindow(temp_hwnd_guanlian) #买卖关联同一支股票的上一级句柄
         if self.debug: print('p_hwnd=',p_hwnd)
         p_hwnd_children = dumpWindow(p_hwnd)
         if self.debug: print('p_hwnd_children=',p_hwnd_children)
         p_p_hwnd=getParentWindow(p_hwnd) #股票交易第一级句柄
         p_p_hwnd_children = dumpWindow(p_p_hwnd)   #右侧操作区
         self.__menu_hwnds = dumpWindow(p_p_hwnd_children[0][0])
         if self.debug: print(self.__menu_hwnds)
         self.__buy_sell_hwnds = p_hwnd_children
         EXPECT_LEN = 68
         if len(self.__buy_sell_hwnds) != EXPECT_LEN:
             sm.send_mail(sub='无法获得通达信对买对卖界面的窗口句柄',content='子句柄数量为 %s,不等于期望数量:%s.也许软件亿升级。' %(len(self.__buy_sell_hwnds),EXPECT_LEN))
             tkinter.messagebox.showerror('错误', '无法获得通达信对买对卖界面的窗口句柄')
         else:
             pass
     else:
         sm.send_mail(sub='无法获得  买卖关联同一支股票 的窗口句柄',content='请点击  双向委托 按钮' )
         tkinter.messagebox.showerror('错误', '无法获得 "买卖关联同一支股票"的窗口句柄')
     return
Esempio n. 2
0
    def __init__(self):

        self.__top_hwnd = findTopWindow(wantedText='网上股票交易系统5.0')
        temp_hwnds = dumpWindows(self.__top_hwnd)[0][0]
        temp_hwnds = dumpWindow(temp_hwnds)[4][0]
        self.__buy_sell_hwnds = dumpWindow(temp_hwnds)
        print(len(self.__buy_sell_hwnds))
        if len(self.__buy_sell_hwnds) != 73:
            tkinter.messagebox.showerror('错误', '无法获得同花顺双向委托界面的窗口句柄')
Esempio n. 3
0
    def __init__(self):

        self.__top_hwnd = findTopWindow(wantedText='网上股票交易系统5.0')
        temp_hwnds = dumpWindows(self.__top_hwnd)[0][0]
        temp_hwnds = dumpWindow(temp_hwnds)[4][0]
        self.__buy_sell_hwnds = dumpWindow(temp_hwnds)
        print(len(self.__buy_sell_hwnds) )
        if len(self.__buy_sell_hwnds) != 73:
            tkinter.messagebox.showerror('错误', '无法获得同花顺双向委托界面的窗口句柄')
Esempio n. 4
0
    def get_add_acc_handles(self):
        #trade_main_hwnd = win32gui.FindWindow(0, self.Title)  # 交易窗口
        #operate_frame_hwnd = win32gui.GetDlgItem(trade_main_hwnd, 59648)  # 操作窗口框架
        tool_menu_hwnd = win32gui.GetDlgItem(self.trade_main_hwnd,
                                             59392)  # 工具栏窗口框架
        tool_menu_hwnd_sub = dumpWindow(tool_menu_hwnd)
        add_acc_hwnd = win32gui.GetDlgItem(tool_menu_hwnd_sub[0][0],
                                           1691)  # 工具栏添加账户按钮

        clickButton(add_acc_hwnd)
        new_add_acc_login_hwnd = win32gui.FindWindow(0, '用户登录')  # 交易窗口
        print('new_add_acc_login_hwnd=', new_add_acc_login_hwnd)
        return add_acc_hwnd
        """
Esempio n. 5
0
    def init_hwnd(self):
        self.__top_hwnd = findTopWindow(wantedClass='TdxW_MainFrame_Class')
        self.__button = {
            'refresh': 180,
            'position': 145,
            'deal': 112,
            'withdrawal': 83,
            'sell': 50,
            'buy': 20
        }
        windows = dumpWindows(self.__top_hwnd)
        if self.debug: print('windows=', windows)
        temp_hwnd = 0
        temp_hwnd_guanlian = 0
        p_hwnd = 0
        self.p_acc_hwnd = 0
        self.acc_hwnd = 0
        self.new_stock_order_hwnd = 0
        find_guan_lian = False
        find_new_stock = False
        find_combobox = False
        for window in windows:
            child_hwnd, window_text, window_class = window
            if window_text == '买卖关联同一支股票':
                temp_hwnd_guanlian = child_hwnd
                print("find the hwnd: 买卖关联同一支股票, ", temp_hwnd_guanlian)
            if window_class == 'MHPToolBar' and window_text == 'MainViewBar':
                self.p_acc_hwnd = child_hwnd
                print('parent_acc_combobox_hwnd=', self.p_acc_hwnd)
                p_p_acc_hwnd = getParentWindow(self.p_acc_hwnd)
                acc_windows = dumpWindows(self.p_acc_hwnd)
                for window in acc_windows:
                    child_hwnd, window_text, window_class = window
                    if window_class == 'ComboBox':
                        self.acc_hwnd = child_hwnd
                        find_combobox = True
                        print('acc_combobox_hwnd=', self.acc_hwnd)
            if window_text == '一键申购':
                self.new_stock_order_hwnd = child_hwnd
                find_new_stock = True
            if find_guan_lian and find_new_stock and find_combobox:
                break
        else:
            pass
            #raise Exception("Change saving type failed")

        if temp_hwnd_guanlian:
            p_hwnd = getParentWindow(temp_hwnd_guanlian)  #买卖关联同一支股票的上一级句柄
            if self.debug: print('p_hwnd=', p_hwnd)
            p_hwnd_children = dumpWindow(p_hwnd)
            if self.debug: print('p_hwnd_children=', p_hwnd_children)
            p_p_hwnd = getParentWindow(p_hwnd)  #股票交易第一级句柄
            p_p_hwnd_children = dumpWindow(p_p_hwnd)  #右侧操作区
            self.__menu_hwnds = dumpWindow(p_p_hwnd_children[0][0])
            if self.debug: print(self.__menu_hwnds)
            self.__buy_sell_hwnds = p_hwnd_children
            EXPECT_LEN = 68
            print(len(self.__buy_sell_hwnds))
            if len(self.__buy_sell_hwnds) != EXPECT_LEN:
                sm.send_mail(sub='无法获得通达信对买对卖界面的窗口句柄',
                             content='子句柄数量为 %s,不等于期望数量:%s.也许软件亿升级。' %
                             (len(self.__buy_sell_hwnds), EXPECT_LEN))
                tkinter.messagebox.showerror('错误', '无法获得通达信对买对卖界面的窗口句柄')
            else:
                pass
        else:
            sm.send_mail(sub='无法获得  买卖关联同一支股票 的窗口句柄', content='请点击  双向委托 按钮')
            tkinter.messagebox.showerror('错误', '无法获得 "买卖关联同一支股票"的窗口句柄')
        return