Python ctypes.wintypes 模块,LPARAM 实例源码

我们从Python开源项目中,提取了以下18个代码示例,用于说明如何使用ctypes.wintypes.LPARAM

项目:puppet    作者:Raytone-D    | 项目源码 | 文件源码
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}
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
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)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
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))
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
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)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
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))
项目:oil    作者:oilshell    | 项目源码 | 文件源码
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)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
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))
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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))
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
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)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
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))
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
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)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
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))
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
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)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
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))
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
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)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
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))
项目:petronia    作者:groboclown    | 项目源码 | 文件源码
def shell__open_start_menu(show_taskbar):
    # Find the task bar window
    taskbar_hwnd = windll.user32.FindWindowW("Shell_TrayWnd", None)
    if taskbar_hwnd is None or 0 == taskbar_hwnd:
        raise WinError()
    taskbar_size = wintypes.RECT()
    windll.user32.GetWindowRect(taskbar_hwnd, byref(taskbar_size))

    # Find the process ID of the taskbar window.
    taskbar_pid = wintypes.DWORD()
    windll.user32.GetWindowThreadProcessId(taskbar_hwnd, byref(taskbar_pid))

    triggered_start = [False]

    # Find the "Start" button in the taskbar.
    def child_window_callback(hwnd, lparam):
        class_buff = create_unicode_buffer(256)
        length = windll.user32.GetClassNameW(hwnd, class_buff, 256)
        if length <= 0:
            class_buff = None
        else:
            class_buff = class_buff.value[:length]
        length = windll.user32.GetWindowTextLengthW(hwnd)
        if length > 0:
            title_buff = create_unicode_buffer(length + 1)
            windll.user32.GetWindowTextW(hwnd, title_buff, length + 1)
            print("DEBUG - Inspecting {0} | {2} = {1}".format(hwnd, title_buff.value, class_buff))
            if title_buff.value == "Start":
                # Found the window
                print("DEBUG sending Click message")

                # Attach our thread input to the start button, so we can send it a message.
                current_thread_id = windll.kernel32.GetCurrentThreadId()
                thread_process_id = windll.user32.GetWindowThreadProcessId(hwnd, None)
                m_res = windll.user32.AttachThreadInput(thread_process_id, current_thread_id, True)
                m_res = windll.user32.SendMessageW(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, 0)
                if m_res == 0:
                    # Don't look anymore
                    triggered_start[0] = True
                    return False
                else:
                    try:
                        print("<<ERROR pressing start button>>")
                        raise WinError()
                    except OSError:
                        import traceback
                        traceback.print_exc()
        return True

    callback_type = CFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
    callback_ptr = callback_type(child_window_callback)
    print("DEBUG Iterating over windows for taskbar pid {0}".format(taskbar_pid.value))
    windll.user32.EnumChildWindows(taskbar_hwnd, callback_ptr, 0)

    # if not triggered_start[0]:
    #     raise OSError("Could not find start button")