How to use the comtypes.IUnknown function in comtypes

To help you get started, we’ve selected a few comtypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nvaccess / nvda / source / comHelper.py View on Github external
def getActiveObject(progid, dynamic=False,appModule=None):
	"""Get an active COM object, handling privilege issues.
	This is similar to comtypes.client.GetActiveObject
	except that it can retrieve objects from normal processes when NVDA is running with uiAccess.
	"""
	if appModule:
		if not appModule.helperLocalBindingHandle:
			raise ValueError("appModule does not have a binding handle")
		import NVDAHelper
		p=ctypes.POINTER(comtypes.IUnknown)()
		res=NVDAHelper.localLib.nvdaInProcUtils_getActiveObject(appModule.helperLocalBindingHandle,progid,ctypes.byref(p))
		if res!=0:
			raise ctypes.WinError(res)
		if not p:
			raise RuntimeError("NULL IUnknown pointer")
		if dynamic:
			return comtypes.client.dynamic.Dispatch(p.QueryInterface(IDispatch))
		else:
			return comtypes.client.GetBestInterface(p)
	try:
		return comtypes.client.GetActiveObject(progid, dynamic=dynamic)
	except WindowsError as e:
		if e.winerror not in (MK_E_UNAVAILABLE, CO_E_CLASSSTRING):
			# This isn't related to privileges.
			raise
	p = subprocess.Popen((config.SLAVE_FILENAME, "comGetActiveObject", progid, "%d" % dynamic),
github Qirky / PyKinectTk / PyKinectTk / utils / PyKinect2 / PyKinectV2.py View on Github external
##        #return Gain
##

class IAudioBeamFrameReader(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{B5733DE9-6ECF-46B2-8B23-A16D71F1A75C}')
    _idlflags_ = []
class IAudioBeamFrameArrivedEventArgs(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{E0DBE62D-2045-4571-8D1D-ECF3981E3C3D}')
    _idlflags_ = []
class IAudioBeamFrameList(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{5393C8B9-C044-49CB-BDD6-23DFFFD7427E}')
    _idlflags_ = []
class IAudioSource(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{52D1D743-AED1-4E61-8AF8-19EF287A662C}')
    _idlflags_ = []
IAudioBeamFrameReader._methods_ = [
    COMMETHOD([], HRESULT, 'SubscribeFrameArrived',
              ( ['retval', 'out'], POINTER(INT_PTR), 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'UnsubscribeFrameArrived',
              ( ['in'], INT_PTR, 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'GetFrameArrivedEventData',
              ( ['in'], INT_PTR, 'waitableHandle' ),
              ( ['retval', 'out'], POINTER(POINTER(IAudioBeamFrameArrivedEventArgs)), 'eventData' )),
    COMMETHOD([], HRESULT, 'AcquireLatestBeamFrames',
              ( ['retval', 'out'], POINTER(POINTER(IAudioBeamFrameList)), 'audioBeamFrameList' )),
    COMMETHOD(['propget'], HRESULT, 'IsPaused',
              ( ['retval', 'out'], POINTER(c_bool), 'IsPaused' )),
    COMMETHOD(['propput'], HRESULT, 'IsPaused',
github Qirky / PyKinectTk / PyKinectTk / utils / PyKinect2 / PyKinectV2.py View on Github external
class _Vector4(Structure):
    pass
_Vector4._fields_ = [
    ('x', c_float),
    ('y', c_float),
    ('z', c_float),
    ('w', c_float),
]
assert sizeof(_Vector4) == 16, sizeof(_Vector4)
assert alignment(_Vector4) == 4, alignment(_Vector4)
class IBodyIndexFrameReader(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{E9724AA1-EBFA-48F8-9044-E0BE33383B8B}')
    _idlflags_ = []
class IBodyIndexFrameArrivedEventArgs(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{10B7E92E-B4F2-4A36-A459-06B2A4B249DF}')
    _idlflags_ = []
class IBodyIndexFrame(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{2CEA0C07-F90C-44DF-A18C-F4D18075EA6B}')
    _idlflags_ = []
class IBodyIndexFrameSource(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{010F2A40-DC58-44A5-8E57-329A583FEC08}')
    _idlflags_ = []
IBodyIndexFrameReader._methods_ = [
    COMMETHOD([], HRESULT, 'SubscribeFrameArrived',
              ( ['retval', 'out'], POINTER(INT_PTR), 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'UnsubscribeFrameArrived',
              ( ['in'], INT_PTR, 'waitableHandle' )),
github Qirky / PyKinectTk / PyKinectTk / utils / PyKinect2 / PyKinectV2.py View on Github external
def __init__(self):
        self.handlers = []
    
    def __iadd__(self, other):
        self.handlers.append(other)
        return self
        
    def __isub__(self, other):
        self.handlers.remove(other)
        return self

    def fire(self, *args):
        for handler in self.handlers:
            handler(*args)

class IBody(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{46AEF731-98B0-4D18-827B-933758678F4A}')
    _idlflags_ = []
class _Joint(Structure):
    pass
class _JointOrientation(Structure):
    pass

# values for enumeration '_DetectionResult'
DetectionResult_Unknown = 0
DetectionResult_No = 1
DetectionResult_Maybe = 2
DetectionResult_Yes = 3
_DetectionResult = c_int # enum

# values for enumeration '_HandState'
github Kinect / PyKinect2 / pykinect2 / PyKinectV2.py View on Github external
##    @property
##    def DepthMinReliableDistance(self):
##        '-no docstring-'
##        #return DepthMinReliableDistance
##
##    @property
##    def IsActive(self):
##        '-no docstring-'
##        #return IsActive
##

class IAudioBeam(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{F692D23A-14D0-432D-B802-DD381A45A121}')
    _idlflags_ = []
class IAudioBeamSubFrame(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{0967DB97-80D1-4BC5-BD2B-4685098D9795}')
    _idlflags_ = []
IAudioBeamFrame._methods_ = [
    COMMETHOD(['propget'], HRESULT, 'AudioSource',
              ( ['retval', 'out'], POINTER(POINTER(IAudioSource)), 'AudioSource' )),
    COMMETHOD(['propget'], HRESULT, 'duration',
              ( ['retval', 'out'], POINTER(c_longlong), 'duration' )),
    COMMETHOD(['propget'], HRESULT, 'AudioBeam',
              ( ['retval', 'out'], POINTER(POINTER(IAudioBeam)), 'AudioBeam' )),
    COMMETHOD(['propget'], HRESULT, 'SubFrameCount',
              ( ['retval', 'out'], POINTER(c_uint), 'pSubFrameCount' )),
    COMMETHOD([], HRESULT, 'GetSubFrame',
              ( [], c_uint, 'subFrameIndex' ),
              ( ['out'], POINTER(POINTER(IAudioBeamSubFrame)), 'audioBeamSubFrame' )),
    COMMETHOD(['propget'], HRESULT, 'RelativeTimeStart',
github cloudbase / cloudbase-init / cloudbaseinit / utils / windows / vds.py View on Github external
'pDiskProperties')),
        comtypes.COMMETHOD([], comtypes.HRESULT, 'GetPack',
                           (['out'], ctypes.POINTER(ctypes.POINTER(IVdsPack)),
                            'ppPack')),
        comtypes.COMMETHOD([], comtypes.HRESULT, 'GetIdentificationData',
                           (['out'], ctypes.c_void_p, 'pLunInfo')),
        comtypes.COMMETHOD([], comtypes.HRESULT, 'QueryExtents',
                           (['out'], ctypes.POINTER(ctypes.POINTER(
                                                    VDS_DISK_EXTENT)),
                            'ppExtentArray'),
                           (['out'], ctypes.POINTER(wintypes.LONG),
                            'plNumberOfExtents')),
    ]


class IVdsAsync(comtypes.IUnknown):
    _iid_ = comtypes.GUID("{d5d23b6d-5a55-4492-9889-397a3c2d2dbc}")

    _methods_ = [
        comtypes.COMMETHOD([], comtypes.HRESULT, 'Cancel'),
        comtypes.COMMETHOD([], comtypes.HRESULT, 'Wait',
                           (['out'], ctypes.POINTER(
                               ctypes.HRESULT), 'pHrResult'),
                           (['out'], ctypes.POINTER(VDS_ASYNC_OUTPUT),
                            'pAsyncOut')),
        comtypes.COMMETHOD([], comtypes.HRESULT, 'QueryStatus',
                           (['out'], ctypes.POINTER(
                            ctypes.HRESULT), 'pHrResult'),
                           (['out'], ctypes.POINTER(wintypes.ULONG),
                            'pulPercentCompleted')),
    ]
github Kinect / PyKinect2 / pykinect2 / PyKinectV2.py View on Github external
_iid_ = GUID('{24CBAB8E-DF1A-4FA8-827E-C1B27A44A3A1}')
    _idlflags_ = []
class IColorFrameReader(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{9BEA498C-C59C-4653-AAF9-D884BAB7C35B}')
    _idlflags_ = []

# values for enumeration '_ColorImageFormat'
ColorImageFormat_None = 0
ColorImageFormat_Rgba = 1
ColorImageFormat_Yuv = 2
ColorImageFormat_Bgra = 3
ColorImageFormat_Bayer = 4
ColorImageFormat_Yuy2 = 5
_ColorImageFormat = c_int # enum
class IKinectSensor(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{3C6EBA94-0DE1-4360-B6D4-653A10794C8B}')
    _idlflags_ = []
IColorFrameSource._methods_ = [
    COMMETHOD([], HRESULT, 'SubscribeFrameCaptured',
              ( ['retval', 'out'], POINTER(INT_PTR), 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'UnsubscribeFrameCaptured',
              ( ['in'], INT_PTR, 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'GetFrameCapturedEventData',
              ( ['in'], INT_PTR, 'waitableHandle' ),
              ( ['retval', 'out'], POINTER(POINTER(IFrameCapturedEventArgs)), 'eventData' )),
    COMMETHOD(['propget'], HRESULT, 'IsActive',
              ( ['retval', 'out'], POINTER(c_bool), 'IsActive' )),
    COMMETHOD([], HRESULT, 'OpenReader',
              ( ['retval', 'out'], POINTER(POINTER(IColorFrameReader)), 'reader' )),
    COMMETHOD([], HRESULT, 'CreateFrameDescription',
github Qirky / PyKinectTk / PyKinectTk / utils / PyKinect2 / PyKinectV2.py View on Github external
('x', c_float),
    ('y', c_float),
    ('z', c_float),
    ('w', c_float),
]
assert sizeof(_Vector4) == 16, sizeof(_Vector4)
assert alignment(_Vector4) == 4, alignment(_Vector4)
class IBodyIndexFrameReader(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{E9724AA1-EBFA-48F8-9044-E0BE33383B8B}')
    _idlflags_ = []
class IBodyIndexFrameArrivedEventArgs(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{10B7E92E-B4F2-4A36-A459-06B2A4B249DF}')
    _idlflags_ = []
class IBodyIndexFrame(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{2CEA0C07-F90C-44DF-A18C-F4D18075EA6B}')
    _idlflags_ = []
class IBodyIndexFrameSource(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{010F2A40-DC58-44A5-8E57-329A583FEC08}')
    _idlflags_ = []
IBodyIndexFrameReader._methods_ = [
    COMMETHOD([], HRESULT, 'SubscribeFrameArrived',
              ( ['retval', 'out'], POINTER(INT_PTR), 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'UnsubscribeFrameArrived',
              ( ['in'], INT_PTR, 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'GetFrameArrivedEventData',
              ( ['in'], INT_PTR, 'waitableHandle' ),
              ( ['retval', 'out'], POINTER(POINTER(IBodyIndexFrameArrivedEventArgs)), 'eventData' )),
    COMMETHOD([], HRESULT, 'AcquireLatestFrame',
github enthought / comtypes / comtypes / connectionpoints.py View on Github external
_GUID = GUID

class tagCONNECTDATA(Structure):
    _fields_ = [
        ('pUnk', POINTER(IUnknown)),
        ('dwCookie', c_ulong),
    ]
CONNECTDATA = tagCONNECTDATA

################################################################

class IConnectionPointContainer(IUnknown):
    _iid_ = GUID('{B196B284-BAB4-101A-B69C-00AA00341D07}')
    _idlflags_ = []

class IConnectionPoint(IUnknown):
    _iid_ = GUID('{B196B286-BAB4-101A-B69C-00AA00341D07}')
    _idlflags_ = []

class IEnumConnections(IUnknown):
    _iid_ = GUID('{B196B287-BAB4-101A-B69C-00AA00341D07}')
    _idlflags_ = []

    def __iter__(self):
        return self

    def next(self):
        cp, fetched = self.Next(1)
        if fetched == 0:
            raise StopIteration
        return cp
github Kinect / PyKinect2 / pykinect2 / PyKinectV2.py View on Github external
##        #return Gain
##

class IAudioBeamFrameReader(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{B5733DE9-6ECF-46B2-8B23-A16D71F1A75C}')
    _idlflags_ = []
class IAudioBeamFrameArrivedEventArgs(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{E0DBE62D-2045-4571-8D1D-ECF3981E3C3D}')
    _idlflags_ = []
class IAudioBeamFrameList(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{5393C8B9-C044-49CB-BDD6-23DFFFD7427E}')
    _idlflags_ = []
class IAudioSource(comtypes.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{52D1D743-AED1-4E61-8AF8-19EF287A662C}')
    _idlflags_ = []
IAudioBeamFrameReader._methods_ = [
    COMMETHOD([], HRESULT, 'SubscribeFrameArrived',
              ( ['retval', 'out'], POINTER(INT_PTR), 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'UnsubscribeFrameArrived',
              ( ['in'], INT_PTR, 'waitableHandle' )),
    COMMETHOD([], HRESULT, 'GetFrameArrivedEventData',
              ( ['in'], INT_PTR, 'waitableHandle' ),
              ( ['retval', 'out'], POINTER(POINTER(IAudioBeamFrameArrivedEventArgs)), 'eventData' )),
    COMMETHOD([], HRESULT, 'AcquireLatestBeamFrames',
              ( ['retval', 'out'], POINTER(POINTER(IAudioBeamFrameList)), 'audioBeamFrameList' )),
    COMMETHOD(['propget'], HRESULT, 'IsPaused',
              ( ['retval', 'out'], POINTER(c_bool), 'IsPaused' )),
    COMMETHOD(['propput'], HRESULT, 'IsPaused',