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

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

项目:code    作者:ActiveState    | 项目源码 | 文件源码
def which_file(fname):
    """prints paths for fname where fname can be found,
    in case of .dll loads it"""
    files = []
    path = win32api.GetEnvironmentVariable('PATH')
    # try paths as described in MSDN
    dirs = [os.getcwd(), win32api.GetSystemDirectory(), win32api.GetWindowsDirectory()] + path.split(';')
    dirs_norm = []
    dirs_l = []
    for d in dirs:
        dn = d.lower()
        if dn not in dirs_l:
            dirs_l.append(dn)
            dirs_norm.append(d)
    for d in dirs_norm:
        fname2 = os.path.join(d, fname)
        if os.path.exists(fname2):
            if fname2 not in files:
                files.append(fname2)
    if files:
        print('\n'.join([get_file_info(f) for f in files]))
    h = 0
    if fname.lower().endswith('.dll'):
        print('\ttrying to load "%s" ...' % (fname))
        try:
            h = win32api.LoadLibrary(fname)
            if h:
                dll_name = win32api.GetModuleFileName(h)
                print('\t%s loaded' % (dll_name))
        except:
            print('\tCannot load "%s" !!!' % (fname))
项目:driveboardapp    作者:nortd    | 项目源码 | 文件源码
def get_windows_dir():
    """
    Return the Windows directory e.g. C:\\Windows.
    """
    try:
        import win32api
    except ImportError:
        windir = compat.getenv('SystemRoot', compat.getenv('WINDIR'))
    else:
        windir = win32api.GetWindowsDirectory()
    if not windir:
        raise SystemExit("Error: Can not determine your Windows directory")
    return windir
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def demo():
    import glob
    winDir=win32api.GetWindowsDirectory()
    for fileName in glob.glob1(winDir, '*.bmp')[:2]:
        bitmapTemplate.OpenDocumentFile(os.path.join(winDir, fileName))
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def GetTestVideoModule():
    global videoControlModule, videoControlFileName
    win32ui.DoWaitCursor(1)
    videoControlModule = gencache.EnsureModule("{05589FA0-C356-11CE-BF01-00AA0055595A}", 0, 2, 0)
    win32ui.DoWaitCursor(0)
    if videoControlModule is None:
        return None
    fnames = glob.glob(os.path.join(win32api.GetWindowsDirectory(), "*.avi"))
    if not fnames:
        print "No AVI files available in system directory"
        return None
    videoControlFileName = fnames[0]
    return videoControlModule
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def demo():
    import glob
    winDir=win32api.GetWindowsDirectory()
    for fileName in glob.glob1(winDir, '*.bmp')[:2]:
        bitmapTemplate.OpenDocumentFile(os.path.join(winDir, fileName))
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def GetTestVideoModule():
    global videoControlModule, videoControlFileName
    win32ui.DoWaitCursor(1)
    videoControlModule = gencache.EnsureModule("{05589FA0-C356-11CE-BF01-00AA0055595A}", 0, 2, 0)
    win32ui.DoWaitCursor(0)
    if videoControlModule is None:
        return None
    fnames = glob.glob(os.path.join(win32api.GetWindowsDirectory(), "*.avi"))
    if not fnames:
        print("No AVI files available in system directory")
        return None
    videoControlFileName = fnames[0]
    return videoControlModule
项目:mac-package-build    作者:persepolisdm    | 项目源码 | 文件源码
def get_windows_dir():
    """
    Return the Windows directory e.g. C:\\Windows.
    """
    try:
        import win32api
    except ImportError:
        windir = compat.getenv('SystemRoot', compat.getenv('WINDIR'))
    else:
        windir = win32api.GetWindowsDirectory()
    if not windir:
        raise SystemExit("Error: Can not determine your Windows directory")
    return windir
项目:AutoDiffAgent    作者:icewall    | 项目源码 | 文件源码
def getFlashDirectory():
        #create flash path
        flashPath = win32api.GetWindowsDirectory()
        system32 = "SysWOW64" if is64Bits() else "system32"
        flashPath = os.path.join(flashPath,system32,"Macromed\\Flash")
        Logger.log(flashPath)
        return flashPath