当前位置: 首页>>代码示例>>Python>>正文


Python wintypes.LPARAM属性代码示例

本文整理汇总了Python中ctypes.wintypes.LPARAM属性的典型用法代码示例。如果您正苦于以下问题:Python wintypes.LPARAM属性的具体用法?Python wintypes.LPARAM怎么用?Python wintypes.LPARAM使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ctypes.wintypes的用法示例。


在下文中一共展示了wintypes.LPARAM属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_root

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import LPARAM [as 别名]
def get_root(key: list =['网上股票交易系统', '通达信']) -> tuple:
    from ctypes.wintypes import BOOL, HWND, LPARAM

    @ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
    def callback(hwnd, lparam):
        user32.GetWindowTextW(hwnd, buf, 64)
        for s in key:
            if s in buf.value:
                handle.value = hwnd
                return False
        return True

    buf = ctypes.create_unicode_buffer(64)
    handle = ctypes.c_ulong()
    user32.EnumWindows(callback)
    return handle.value, buf.value 
开发者ID:Raytone-D,项目名称:puppet,代码行数:18,代码来源:puppet_util.py

示例2: finder

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import LPARAM [as 别名]
def finder(register):
    ''' 枚举所有可用的broker交易端并实例化 '''
    team = set()
    buff = buffer(32)
    @ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
    def check(hwnd, extra):
        if op.IsWindowVisible(hwnd):
            op.GetWindowTextW(hwnd, buff, 32)
            if '交易系统' in buff.value:
                team.add(hwnd)
        return 1
    op.EnumWindows(check, 0)
    
    def get_nickname(hwnd):
        account = hwnd
        for i in 59392, 0, 1711:
            account = op.GetDlgItem(account, i)
        op.SendMessageW(account, WM_GETTEXT, 32, buff)
        return register.get(buff.value[-3:])
        
    return {get_nickname(hwnd): unity(hwnd) for hwnd in team if hwnd} 
开发者ID:Raytone-D,项目名称:puppet,代码行数:23,代码来源:release_puppet_unity_ths.py

示例3: run_windows

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import LPARAM [as 别名]
def run_windows(self):
        from ctypes.wintypes import DWORD, WPARAM, LPARAM, MSG

        class KBDLLHOOKSTRUCT(Structure):
            _fields_ = [
                ("vk_code", DWORD),
                ("scan_code", DWORD),
                ("flags", DWORD),
                ("time", c_int),
                ("dwExtraInfo", POINTER(DWORD))
            ]

        def callback(nCode, wParam, lParam):
            pid = c_ulong()
            windll.user32.GetWindowThreadProcessId(windll.user32.GetForegroundWindow(), byref(pid))
            if pid.value == self.pid:
                windll.user32.SendMessageA(self.window.winId(), wParam, lParam.contents.vk_code, 0)
            return windll.user32.CallNextHookEx(None, nCode, wParam, lParam)
 
        function = CFUNCTYPE(c_int, WPARAM, LPARAM, POINTER(KBDLLHOOKSTRUCT))(callback)
        hook = windll.user32.SetWindowsHookExW(13, function, windll.kernel32.GetModuleHandleW(None), 0)

        msg = POINTER(MSG)()
        while self.running:
            try:
                windll.user32.GetMessageW(msg, 0, 0, 0)
                windll.user32.TranslateMessage(msg)
                windll.user32.DispatchMessageA(msg)
            except: pass

        windll.user32.UnhookWindowsHookEx(hook) 
开发者ID:RiotGames,项目名称:leaguedirector,代码行数:33,代码来源:bindings.py

示例4: test_issue_8959_b

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import LPARAM [as 别名]
def test_issue_8959_b(self):
        from ctypes.wintypes import BOOL, HWND, LPARAM
        global windowCount
        windowCount = 0

        @WINFUNCTYPE(BOOL, HWND, LPARAM)
        def EnumWindowsCallbackFunc(hwnd, lParam):
            global windowCount
            windowCount += 1
            return True #Allow windows to keep enumerating

        windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:14,代码来源:test_callbacks.py

示例5: test_PARAM

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import LPARAM [as 别名]
def test_PARAM(self):
        from ctypes import wintypes
        self.assertEqual(sizeof(wintypes.WPARAM),
                             sizeof(c_void_p))
        self.assertEqual(sizeof(wintypes.LPARAM),
                             sizeof(c_void_p)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:test_win32.py

示例6: test_issue_8959_b

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import LPARAM [as 别名]
def test_issue_8959_b(self):
            from ctypes.wintypes import BOOL, HWND, LPARAM
            global windowCount
            windowCount = 0

            @WINFUNCTYPE(BOOL, HWND, LPARAM)
            def EnumWindowsCallbackFunc(hwnd, lParam):
                global windowCount
                windowCount += 1
                return True #Allow windows to keep enumerating

            windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:14,代码来源:test_callbacks.py

示例7: test_PARAM

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import LPARAM [as 别名]
def test_PARAM(self):
            from ctypes import wintypes
            self.assertEqual(sizeof(wintypes.WPARAM),
                                 sizeof(c_void_p))
            self.assertEqual(sizeof(wintypes.LPARAM),
                                 sizeof(c_void_p)) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:8,代码来源:test_win32.py

示例8: enumerate_monitors

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import LPARAM [as 别名]
def enumerate_monitors() -> list:
    """
    enumerate all physical monitor.
    ** 请注意防止返回的 Handle 对象被GC!
    
    https://msdn.microsoft.com/en-us/library/dd162610(v=vs.85).aspx
    BOOL EnumDisplayMonitors(
        _In_ HDC             hdc,
        _In_ LPCRECT         lprcClip,
        _In_ MONITORENUMPROC lpfnEnum,
        _In_ LPARAM          dwData
    );
    
    :return: list contains physical monitor handles
    """
    all_hmonitor = []

    # Factory function of EnumDisplayMonitors callback.
    # 保持引用以防止被GC !
    # https://msdn.microsoft.com/en-us/library/dd145061(v=vs.85).aspx
    _MONITOR_ENUM_PROC = ctypes.WINFUNCTYPE(wintypes.BOOL,
                                            wintypes.HMONITOR,
                                            wintypes.HDC,
                                            ctypes.POINTER(wintypes.LPRECT),
                                            wintypes.LPARAM)

    def __monitor_enum_proc_callback(hmonitor_: wintypes.HMONITOR, hdc, lprect, lparam) -> bool:
        """
        EnumDisplayMonitors callback, append HMONITOR to all_hmonitor list.
        :param hmonitor_:
        :param hdc:
        :param lprect:
        :param lparam:
        :return:
        """
        all_hmonitor.append(hmonitor_)
        return True
    
    if not ctypes.windll.user32.EnumDisplayMonitors(None, None,
                                                    _MONITOR_ENUM_PROC(__monitor_enum_proc_callback), None):
            raise ctypes.WinError()
    
    # get physical monitor handle
    handles = []
    for hmonitor in all_hmonitor:
        handles.extend(_get_physical_monitors_from_hmonitor(hmonitor))
    
    return handles 
开发者ID:dot-osk,项目名称:monitor_ctrl,代码行数:50,代码来源:vcp.py


注:本文中的ctypes.wintypes.LPARAM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。