test_winsound.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码
def has_sound(sound):
    """Find out if a particular event is configured with a default sound"""
    try:
        # Ask the mixer API for the number of devices it knows about.
        # When there are no devices, PlaySound will fail.
        if ctypes.windll.winmm.mixerGetNumDevs() is 0:
            return False

        key = _winreg.OpenKeyEx(_winreg.HKEY_CURRENT_USER,
                "AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound))
        value = _winreg.EnumValue(key, 0)[1]
        if value is not u"":
            return True
        else:
            return False
    except WindowsError:
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号