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


Python win32api.GetFileVersionInfo方法代码示例

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


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

示例1: get_file_version

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import GetFileVersionInfo [as 别名]
def get_file_version(self, path):
        info = win32api.GetFileVersionInfo(path, '\\')
        ms = info['FileVersionMS']
        ls = info['FileVersionLS']
        return (win32api.HIWORD(ms), win32api.LOWORD(ms),
                win32api.HIWORD(ls), win32api.LOWORD(ls)) 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:8,代码来源:windows.py

示例2: getDllVersion

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import GetFileVersionInfo [as 别名]
def getDllVersion(dllPath):
	info = win32api.GetFileVersionInfo(dllPath, '\\')
	return '{:d}.{:d}.{:d}.{:d}'.format(
		info['FileVersionMS'] // 65536,
		info['FileVersionMS'] % 65536,
		info['FileVersionLS'] // 65536,
		info['FileVersionLS'] % 65536
	) 
开发者ID:adamrehn,项目名称:ue4-docker,代码行数:10,代码来源:verify-host-dlls.py

示例3: getFileProperties

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import GetFileVersionInfo [as 别名]
def getFileProperties(fname):
#==============================================================================
    """
    Read all properties of the given file return them as a dictionary.
    """
    import win32api
    propNames = ('Comments', 'InternalName', 'ProductName',
        'CompanyName', 'LegalCopyright', 'ProductVersion',
        'FileDescription', 'LegalTrademarks', 'PrivateBuild',
        'FileVersion', 'OriginalFilename', 'SpecialBuild')

    props = {'FixedFileInfo': None, 'StringFileInfo': None, 'FileVersion': None}

    try:
        # backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc
        fixedInfo = win32api.GetFileVersionInfo(fname, '\\')
        props['FixedFileInfo'] = fixedInfo
        props['FileVersion'] = "%d.%d.%d.%d" % (fixedInfo['FileVersionMS'] / 65536,
                fixedInfo['FileVersionMS'] % 65536, fixedInfo['FileVersionLS'] / 65536,
                fixedInfo['FileVersionLS'] % 65536)

        # \VarFileInfo\Translation returns list of available (language, codepage)
        # pairs that can be used to retreive string info. We are using only the first pair.
        lang, codepage = win32api.GetFileVersionInfo(fname, '\\VarFileInfo\\Translation')[0]

        # any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle
        # two are language/codepage pair returned from above

        strInfo = {}
        for propName in propNames:
            strInfoPath = u'\\StringFileInfo\\%04X%04X\\%s' % (lang, codepage, propName)
            ## print str_info
            strInfo[propName] = win32api.GetFileVersionInfo(fname, strInfoPath)

        props['StringFileInfo'] = strInfo
    except:
        pass

    return props
# =============================================================================
# Shortcuts, start menu
# ============================================================================= 
开发者ID:winpython,项目名称:winpython,代码行数:44,代码来源:utils.py


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