Python win32api 模块,MapVirtualKey() 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用win32api.MapVirtualKey()

项目:Spotilyrics    作者:eitchtee    | 项目源码 | 文件源码
def hwcode(Media):
    hwcode = win32api.MapVirtualKey(Media, 0)
    return hwcode
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def make_key_name(vk, flags):
    # Check alt keys.
    flags_done = 0
    parts = []
    for moddata in _checks:
        for name, checkflag in moddata:
            if flags & checkflag:
                parts.append(name)
                flags_done = flags_done & checkflag
                break
    if flags_done & flags:
        parts.append(hex( flags & ~flags_done ) )
    # Now the key name.
    if vk is None:
        parts.append("<Unknown scan code>")
    else:
        try:
            parts.append(key_code_to_name[vk])
        except KeyError:
            # Not in our virtual key map - ask Windows what character this
            # key corresponds to.
            scancode = win32api.MapVirtualKey(vk, MAPVK_VK_TO_CHAR)
            parts.append(unichr(scancode))
    sep = "+"
    if sep in parts: sep = "-"
    return sep.join([p.capitalize() for p in parts])
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def make_key_name(vk, flags):
    # Check alt keys.
    flags_done = 0
    parts = []
    for moddata in _checks:
        for name, checkflag in moddata:
            if flags & checkflag:
                parts.append(name)
                flags_done = flags_done & checkflag
                break
    if flags_done & flags:
        parts.append(hex( flags & ~flags_done ) )
    # Now the key name.
    if vk is None:
        parts.append("<Unknown scan code>")
    else:
        try:
            parts.append(key_code_to_name[vk])
        except KeyError:
            # Not in our virtual key map - ask Windows what character this
            # key corresponds to.
            scancode = win32api.MapVirtualKey(vk, MAPVK_VK_TO_CHAR)
            parts.append(chr(scancode))
    sep = "+"
    if sep in parts: sep = "-"
    return sep.join([p.capitalize() for p in parts])
项目:spotify-scraper    作者:naschorr    | 项目源码 | 文件源码
def nextSong(self):
        keybd_event(0xB0, MapVirtualKey(0xB0, 0))
项目:spotify-scraper    作者:naschorr    | 项目源码 | 文件源码
def stopSong(self):
        keybd_event(0xB2, MapVirtualKey(0xB2, 0))
项目:spotify-scraper    作者:naschorr    | 项目源码 | 文件源码
def nextSong(self):
        keybd_event(0xB0, MapVirtualKey(0xB0, 0))
项目:spotify-scraper    作者:naschorr    | 项目源码 | 文件源码
def stopSong(self):
        keybd_event(0xB2, MapVirtualKey(0xB2, 0))
项目:spotify-scraper    作者:naschorr    | 项目源码 | 文件源码
def playSong(self):
        ## Play the song
        keybd_event(0xB3, MapVirtualKey(0xB3, 0))
        ## Restart the song
        keybd_event(0xB1, MapVirtualKey(0xB1, 0))