Python pythoncom 模块,WrapObject() 实例源码

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

项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def wrap(ob, iid=None, usePolicy=None, useDispatcher=None):
  """Wraps an object in a PyGDispatch gateway.

     Returns a client side PyI{iid} interface.

     Interface and gateway support must exist for the specified IID, as
     the QueryInterface() method is used.

  """
  if usePolicy is None:
    usePolicy = policy.DefaultPolicy
  if useDispatcher == 1: # True will also work here.
    import win32com.server.dispatcher
    useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher
  if useDispatcher is None or useDispatcher==0:
    ob = usePolicy(ob)
  else:
    ob = useDispatcher(usePolicy, ob)

  # get a PyIDispatch, which interfaces to PyGDispatch
  ob = pythoncom.WrapObject(ob)
  if iid is not None:
    ob = ob.QueryInterface(iid)       # Ask the PyIDispatch if it supports it?
  return ob
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def wrap(ob, iid=None, usePolicy=None, useDispatcher=None):
  """Wraps an object in a PyGDispatch gateway.

     Returns a client side PyI{iid} interface.

     Interface and gateway support must exist for the specified IID, as
     the QueryInterface() method is used.

  """
  if usePolicy is None:
    usePolicy = policy.DefaultPolicy
  if useDispatcher == 1: # True will also work here.
    import win32com.server.dispatcher
    useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher
  if useDispatcher is None or useDispatcher==0:
    ob = usePolicy(ob)
  else:
    ob = useDispatcher(usePolicy, ob)

  # get a PyIDispatch, which interfaces to PyGDispatch
  ob = pythoncom.WrapObject(ob)
  if iid is not None:
    ob = ob.QueryInterface(iid)       # Ask the PyIDispatch if it supports it?
  return ob
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def wrap(ob, iid=None, usePolicy=None, useDispatcher=None):
  """Wraps an object in a PyGDispatch gateway.

     Returns a client side PyI{iid} interface.

     Interface and gateway support must exist for the specified IID, as
     the QueryInterface() method is used.

  """
  if usePolicy is None:
    usePolicy = policy.DefaultPolicy
  if useDispatcher == 1: # True will also work here.
    import win32com.server.dispatcher
    useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher
  if useDispatcher is None or useDispatcher==0:
    ob = usePolicy(ob)
  else:
    ob = useDispatcher(usePolicy, ob)

  # get a PyIDispatch, which interfaces to PyGDispatch
  ob = pythoncom.WrapObject(ob)
  if iid is not None:
    ob = ob.QueryInterface(iid)       # Ask the PyIDispatch if it supports it?
  return ob
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def wrap(ob, iid=None, usePolicy=None, useDispatcher=None):
  """Wraps an object in a PyGDispatch gateway.

     Returns a client side PyI{iid} interface.

     Interface and gateway support must exist for the specified IID, as
     the QueryInterface() method is used.

  """
  if usePolicy is None:
    usePolicy = policy.DefaultPolicy
  if useDispatcher == 1: # True will also work here.
    import win32com.server.dispatcher
    useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher
  if useDispatcher is None or useDispatcher==0:
    ob = usePolicy(ob)
  else:
    ob = useDispatcher(usePolicy, ob)

  # get a PyIDispatch, which interfaces to PyGDispatch
  ob = pythoncom.WrapObject(ob)
  if iid is not None:
    ob = ob.QueryInterface(iid)       # Ask the PyIDispatch if it supports it?
  return ob
项目:Email_My_PC    作者:Jackeriss    | 项目源码 | 文件源码
def CreateSink():
    return pythoncom.WrapObject(FileOperationProgressSink(), shell.IID_IFileOperationProgressSink)
项目:Email_My_PC    作者:Jackeriss    | 项目源码 | 文件源码
def CreateSink():
    return pythoncom.WrapObject(TransferAdviseSink(), shell.IID_ITransferAdviseSink, shell.IID_ITransferAdviseSink)
项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def _CreateInstance_(self, clsid, reqIID):
    try:
      self.policy._CreateInstance_(clsid, reqIID)
      return pythoncom.WrapObject(self, reqIID)
    except:
      return self._HandleException_()
项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def _CreateInstance_(self, clsid, reqIID):
    self._wrap_({ })
    return pythoncom.WrapObject(self, reqIID)
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def _CreateInstance_(self, clsid, reqIID):
    try:
      self.policy._CreateInstance_(clsid, reqIID)
      return pythoncom.WrapObject(self, reqIID)
    except:
      return self._HandleException_()
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def _CreateInstance_(self, clsid, reqIID):
    self._wrap_({ })
    return pythoncom.WrapObject(self, reqIID)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def EditSecurity(self, owner_hwnd=0):
        """Creates an ACL editor dialog based on parameters returned by interface methods"""
        isi=pythoncom.WrapObject(self, authorization.IID_ISecurityInformation, pythoncom.IID_IUnknown)
        authorization.EditSecurity(owner_hwnd, isi)

## folder permissions
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def EditSecurity(self, owner_hwnd=0):
        """Creates an ACL editor dialog based on parameters returned by interface methods"""
        isi=pythoncom.WrapObject(self, authorization.IID_ISecurityInformation, pythoncom.IID_IUnknown)
        authorization.EditSecurity(owner_hwnd, isi)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def CreateSink():
    return pythoncom.WrapObject(FileOperationProgressSink(), shell.IID_IFileOperationProgressSink)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def CreateSink():
    return pythoncom.WrapObject(TransferAdviseSink(), shell.IID_ITransferAdviseSink, shell.IID_ITransferAdviseSink)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def _CreateInstance_(self, clsid, reqIID):
    try:
      self.policy._CreateInstance_(clsid, reqIID)
      return pythoncom.WrapObject(self, reqIID)
    except:
      return self._HandleException_()
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def _CreateInstance_(self, clsid, reqIID):
    self._wrap_({ })
    return pythoncom.WrapObject(self, reqIID)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def EditSecurity(self, owner_hwnd=0):
        """Creates an ACL editor dialog based on parameters returned by interface methods"""
        isi=pythoncom.WrapObject(self, authorization.IID_ISecurityInformation, pythoncom.IID_IUnknown)
        authorization.EditSecurity(owner_hwnd, isi)

## folder permissions
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def EditSecurity(self, owner_hwnd=0):
        """Creates an ACL editor dialog based on parameters returned by interface methods"""
        isi=pythoncom.WrapObject(self, authorization.IID_ISecurityInformation, pythoncom.IID_IUnknown)
        authorization.EditSecurity(owner_hwnd, isi)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def CreateSink():
    return pythoncom.WrapObject(FileOperationProgressSink(), shell.IID_IFileOperationProgressSink)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def CreateSink():
    return pythoncom.WrapObject(TransferAdviseSink(), shell.IID_ITransferAdviseSink, shell.IID_ITransferAdviseSink)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def _CreateInstance_(self, clsid, reqIID):
    try:
      self.policy._CreateInstance_(clsid, reqIID)
      return pythoncom.WrapObject(self, reqIID)
    except:
      return self._HandleException_()
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def _CreateInstance_(self, clsid, reqIID):
    self._wrap_({ })
    return pythoncom.WrapObject(self, reqIID)