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


Python pythoncom.CLSCTX_INPROC_SERVER属性代码示例

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


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

示例1: test

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def test(serverName):
    if string.lower(serverName)==string.lower(win32api.GetComputerName()):
        print "You must specify a remote server name, not the local machine!"
        return

    # Hack to overcome a DCOM limitation.  As the Python.Interpreter object
    # is probably installed locally as an InProc object, DCOM seems to ignore
    # all settings, and use the local object.
    clsctx = pythoncom.CLSCTX_SERVER & ~pythoncom.CLSCTX_INPROC_SERVER
    ob = win32com.client.DispatchEx("Python.Interpreter", serverName, clsctx=clsctx)
    ob.Exec("import win32api")
    actualName = ob.Eval("win32api.GetComputerName()")
    if string.lower(serverName) != string.lower(actualName):
        print "Error: The object created on server '%s' reported its name as '%s'" % (serverName, actualName)
    else:
        print "Object created and tested OK on server '%s'" % serverName 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:18,代码来源:testDCOM.py

示例2: __init__

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def __init__(self, 
                 path=None,
                 arguments=None, 
                 description=None,
                 workingdir=None,
                 iconpath=None,
                 iconidx=0):
        self._base = pythoncom.CoCreateInstance(
            shell.CLSID_ShellLink, None,
            pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink
        )
        data = map(None, 
                   ['"%s"' % os.path.abspath(path), arguments, description,
                    os.path.abspath(workingdir), os.path.abspath(iconpath)], 
                   ("SetPath", "SetArguments", "SetDescription",
                   "SetWorkingDirectory") )
        for value, function in data:
            if value and function:
                # call function on each non-null value
                getattr(self, function)(value)
        if iconpath:
            self.SetIconLocation(iconpath, iconidx) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:24,代码来源:shortcut.py

示例3: CreateShortCut

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def CreateShortCut(Path, Target,Arguments = "", StartIn = "", Icon = ("",0), Description = ""):
    # Get the shell interface.
    sh = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, \
        pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)

    # Get an IPersist interface
    persist = sh.QueryInterface(pythoncom.IID_IPersistFile)

    # Set the data
    sh.SetPath(Target)
    sh.SetDescription(Description)
    sh.SetArguments(Arguments)
    sh.SetWorkingDirectory(StartIn)
    sh.SetIconLocation(Icon[0],Icon[1])
#    sh.SetShowCmd( win32con.SW_SHOWMINIMIZED)

    # Save the link itself.
    persist.Save(Path, 1)
    print "Saved to", Path 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:21,代码来源:testcomext.py

示例4: Get

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def Get(cls, filename):
        sh = pythoncom.CoCreateInstance(
            shell.CLSID_ShellLink,
            None,
            pythoncom.CLSCTX_INPROC_SERVER,
            shell.IID_IShellLink
        )
        persist = sh.QueryInterface(pythoncom.IID_IPersistFile).Load(filename)  # NOQA
        self = cls()
        self.path = filename
        self.target = sh.GetPath(shell.SLGP_SHORTPATH)[0]
        self.description = sh.GetDescription()
        self.arguments = sh.GetArguments()
        self.startIn = sh.GetWorkingDirectory()
        self.icons = sh.GetIconLocation()
        return self 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:18,代码来源:Shortcut.py

示例5: DumpLink

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def DumpLink(fname):
	shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
	persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile)
	persistFile.Load(fname,STGM_READ)
	shellLink.Resolve(0, shell.SLR_ANY_MATCH | shell.SLR_NO_UI)
	fname, findData = shellLink.GetPath(0)
	print "Filename:", fname, ", UNC=", shellLink.GetPath(shell.SLGP_UNCPRIORITY)[0]
	print "Description:", shellLink.GetDescription()
	print "Working Directory:", shellLink.GetWorkingDirectory()
	print "Icon:", shellLink.GetIconLocation() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:dump_link.py

示例6: __init__

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def __init__( self ):
		self._base = pythoncom.CoCreateInstance(
			shell.CLSID_InternetShortcut, None,
			pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IUniformResourceLocator
		) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:IUniformResourceLocator.py

示例7: __init__

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def __init__( self ):
		self._base = pythoncom.CoCreateInstance(
			shell.CLSID_ShellLink, None,
			pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink
		) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:create_link.py

示例8: _cat_registrar

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def _cat_registrar():
  return pythoncom.CoCreateInstance(
    pythoncom.CLSID_StdComponentCategoriesMgr,
    None,
    pythoncom.CLSCTX_INPROC_SERVER,
    pythoncom.IID_ICatRegister
    ) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:register.py

示例9: testVTableInProc

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def testVTableInProc(self):
        # We used to crash running this the second time - do it a few times
        for i in range(3):
            progress("Testing VTables in-process #%d..." % (i+1))
            TestVTable(pythoncom.CLSCTX_INPROC_SERVER) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:testPyComTest.py

示例10: __init__

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def __init__(self,
                 path=None,
                 arguments=None,
                 description=None,
                 workingdir=None,
                 iconpath=None,
                 iconidx=0):
        """
        @param path: Location of the target
        @param arguments: If path points to an executable, optional arguments
                      to pass
        @param description: Human-readable description of target
        @param workingdir: Directory from which target is launched
        @param iconpath: Filename that contains an icon for the shortcut
        @param iconidx: If iconpath is set, optional index of the icon desired
        """
        self._base = pythoncom.CoCreateInstance(
            shell.CLSID_ShellLink, None,
            pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink
        )
        if path is not None:
            self.SetPath(os.path.abspath(path))
        if arguments is not None:
            self.SetArguments(arguments)
        if description is not None:
            self.SetDescription(description)
        if workingdir is not None:
            self.SetWorkingDirectory(os.path.abspath(workingdir))
        if iconpath is not None:
            self.SetIconLocation(os.path.abspath(iconpath), iconidx) 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:32,代码来源:shortcut.py

示例11: create_shortcut

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def create_shortcut(
    path,
    description,
    filename,
    arguments="",
    workdir="",
    iconpath="",
    iconindex=0,
):
    """Create Windows shortcut (.lnk file)"""
    import pythoncom
    from win32com.shell import shell

    ilink = pythoncom.CoCreateInstance(
        shell.CLSID_ShellLink,
        None,
        pythoncom.CLSCTX_INPROC_SERVER,
        shell.IID_IShellLink,
    )
    ilink.SetPath(path)
    ilink.SetDescription(description)
    if arguments:
        ilink.SetArguments(arguments)
    if workdir:
        ilink.SetWorkingDirectory(workdir)
    if iconpath or iconindex:
        ilink.SetIconLocation(iconpath, iconindex)
    # now save it.
    ipf = ilink.QueryInterface(pythoncom.IID_IPersistFile)
    if not filename.endswith('.lnk'):
        filename += '.lnk'
    ipf.Save(filename, 0)


# =============================================================================
# Misc.
# ============================================================================= 
开发者ID:winpython,项目名称:winpython,代码行数:39,代码来源:utils.py

示例12: __init__

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def __init__(self, lnkname):
        self.shortcut = pythoncom.CoCreateInstance(
            shell.CLSID_ShellLink, None,
            pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
        self.shortcut.QueryInterface(pythoncom.IID_IPersistFile).Load(lnkname) 
开发者ID:ActiveState,项目名称:code,代码行数:7,代码来源:recipe-576437.py

示例13: Create

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def Create(
        cls,
        path,
        target,
        arguments="",
        startIn="",
        icon=("", 0),
        description=""
    ):
        """Create a Windows shortcut:

        path - As what file should the shortcut be created?
        target - What command should the desktop use?
        arguments - What arguments should be supplied to the command?
        startIn - What folder should the command start in?
        icon - (filename, index) What icon should be used for the shortcut?
        description - What description should the shortcut be given?

        eg
        Shortcut.Create(
            path=os.path.join (desktop (), "PythonI.lnk"),
            target=r"c:\python\python.exe",
            icon=(r"c:\python\python.exe", 0),
            description="Python Interpreter"
        )
        """
        sh = pythoncom.CoCreateInstance(
            shell.CLSID_ShellLink,
            None,
            pythoncom.CLSCTX_INPROC_SERVER,
            shell.IID_IShellLink
        )
        sh.SetPath(target)
        sh.SetDescription(description)
        sh.SetArguments(arguments)
        sh.SetWorkingDirectory(startIn)
        sh.SetIconLocation(icon[0], icon[1])
        persist = sh.QueryInterface(pythoncom.IID_IPersistFile)
        persist.Save(path, 1) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:41,代码来源:Shortcut.py

示例14: set_shortcut

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def set_shortcut():
	startup_path = shell.SHGetPathFromIDList(shell.SHGetSpecialFolderLocation(0,shellcon.CSIDL_STARTUP))
	shortcut = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, \
		shell.IID_IShellLink)
	shortcut.SetPath(os.getcwd()+'\\Email My PC Launcher.exe')
	shortcut.SetWorkingDirectory(os.getcwd())
	shortcut.SetIconLocation(os.getcwd()+'\\ui\\images\\Icon.ico',0)
	shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(startup_path+'\\Emai My PC.lnk',0)

#删除开机启动快捷方式 
开发者ID:Jackeriss,项目名称:Email_My_PC,代码行数:12,代码来源:Email My PC.py

示例15: create_shortcut

# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CLSCTX_INPROC_SERVER [as 别名]
def create_shortcut(path, description, filename,
                        arguments="", workdir="", iconpath="", iconindex=0):
        try:
            import pythoncom
        except ImportError:
            print("pywin32 is required to run this script manually",
                  file=sys.stderr)
            sys.exit(1)
        from win32com.shell import shell, shellcon  # analysis:ignore

        ilink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None,
                                           pythoncom.CLSCTX_INPROC_SERVER,
                                           shell.IID_IShellLink)
        ilink.SetPath(path)
        ilink.SetDescription(description)
        if arguments:
            ilink.SetArguments(arguments)
        if workdir:
            ilink.SetWorkingDirectory(workdir)
        if iconpath or iconindex:
            ilink.SetIconLocation(iconpath, iconindex)
        # now save it.
        ipf = ilink.QueryInterface(pythoncom.IID_IPersistFile)
        ipf.Save(filename, 0)

    # Support the same list of "path names" as bdist_wininst. 
开发者ID:SanPen,项目名称:GridCal,代码行数:28,代码来源:windows_post_install.py


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