Esempio n. 1
0
    return kstrokes


if __name__ == '__main__':
    import sys

    program_instance = try_open_single_program('407631B6-78D3-4EFC-A868-40BBB7204CF1')
    if not program_instance:
        sys.exit()

    raise_process_priority()

    context = lib.interception_create_context()

    lib.interception_set_filter(context, lib.interception_is_keyboard,
                                lib.INTERCEPTION_FILTER_KEY_DOWN |
                                lib.INTERCEPTION_FILTER_KEY_UP)

    kstroke = ffi.new('InterceptionKeyStroke *')

    while True:
        device = lib.interception_wait(context)
        if not lib.interception_receive(context, device, kstroke, 1):
            break
        kstrokes = caps2esc(kstroke[0])

        if kstrokes:
            lib.interception_send(context, device,
                                  ffi.new('InterceptionKeyStroke []', kstrokes),
                                  len(kstrokes))
    lib.interception_destroy_context(context)
Esempio n. 2
0
def INTERCEPTION_KEYBOARD(index):
    return index + 1


def INTERCEPTION_MOUSE(index):
    return INTERCEPTION_MAX_KEYBOARD + index + 1


if __name__ == '__main__':

    raise_process_priority()

    context = lib.interception_create_context()

    lib.interception_set_filter(
        context, lib.interception_is_keyboard,
        lib.INTERCEPTION_FILTER_KEY_DOWN | lib.INTERCEPTION_FILTER_KEY_UP)
    lib.interception_set_filter(context, lib.interception_is_mouse,
                                lib.INTERCEPTION_FILTER_MOUSE_LEFT_BUTTON_DOWN)

    stroke = ffi.new('InterceptionMouseStroke *')
    while True:
        device = lib.interception_wait(context)
        if not lib.interception_receive(context, device, stroke, 1):
            break

        if lib.interception_is_keyboard(device):
            kstroke = ffi.cast('InterceptionKeyStroke *', stroke)
            print('INTERCEPTION_KEYBOARD({})'.format(device -
                                                     INTERCEPTION_KEYBOARD(0)))
            if kstroke.code == SCANCODE_ESC: