def test(self):
        self.failUnlessEqual(GUID(), GUID())
        self.failUnlessEqual(
            GUID("{00000000-0000-0000-C000-000000000046}"), GUID("{00000000-0000-0000-C000-000000000046}")
        )

        self.failUnlessEqual(
            str(GUID("{0002DF01-0000-0000-C000-000000000046}")), "{0002DF01-0000-0000-C000-000000000046}"
        )
        self.failUnlessEqual(
            repr(GUID("{0002DF01-0000-0000-C000-000000000046}")), 'GUID("{0002DF01-0000-0000-C000-000000000046}")'
        )

        self.assertRaises(WindowsError, GUID, "abc")
        self.assertRaises(WindowsError, GUID.from_progid, "abc")

        self.assertRaises(WindowsError, lambda guid: guid.as_progid(), GUID("{00000000-0000-0000-C000-000000000046}"))

        if os.name == "nt":
            self.failUnlessEqual(
                GUID.from_progid("InternetExplorer.Application"), GUID("{0002DF01-0000-0000-C000-000000000046}")
            )
            self.failUnlessEqual(
                GUID("{0002DF01-0000-0000-C000-000000000046}").as_progid(), u"InternetExplorer.Application.1"
            )
        elif os.name == "ce":
            self.failUnlessEqual(GUID.from_progid("JScript"), GUID("{f414c260-6ac0-11cf-b6d1-00aa00bbbb58}"))
            self.failUnlessEqual(GUID("{f414c260-6ac0-11cf-b6d1-00aa00bbbb58}").as_progid(), u"JScript")

        self.failIfEqual(GUID.create_new(), GUID.create_new())
Beispiel #2
0
def DllGetClassObject(rclsid, riid, ppv):
    COMObject.__run_inprocserver__()

    iid = GUID.from_address(riid)
    clsid = GUID.from_address(rclsid)

    if not _logging_configured:
        _setup_logging(clsid)

    # This function is directly called by C code, and receives C
    # integers as parameters. rclsid is a pointer to the CLSID for the
    # coclass we want to be created, riid is a pointer to the
    # requested interface.
    try:
        _debug("DllGetClassObject(clsid=%s, iid=%s)", clsid, iid)

        cls = inproc_find_class(clsid)
        if not cls:
            return CLASS_E_CLASSNOTAVAILABLE

        result = ClassFactory(cls).IUnknown_QueryInterface(None, ctypes.pointer(iid), ppv)
        _debug("DllGetClassObject() -> %s", result)
        return result
    except Exception:
        _critical("DllGetClassObject", exc_info=True)
        return E_FAIL
Beispiel #3
0
 def __init__(self, guid=None, content=None):
     if guid is None:
         guid = str(GUID.create_new())
     elif isinstance(guid, Password):
         guid = guid.guid
     if content is not None:
         self.database[guid] = content
     self.guid = guid
Beispiel #4
0
 def GetData(self):
     from comtypes import GUID
     self.guid = str(GUID.create_new())
     self.time = str(time.time())
     attr = []
     attr.append(('Version', str(eg.Version.string)))
     attr.append(('Guid', self.guid))
     attr.append(('Time', self.time))
     return attr, None
Beispiel #5
0
 def GetData(self):
     from comtypes import GUID
     attr, text = ContainerItem.GetData(self)
     self.guid = str(GUID.create_new())
     self.time = str(time.time())
     attr.append(('Version', str(eg.revision)))
     attr.append(('Guid', self.guid))
     attr.append(('Time', self.time))
     return attr, text
Beispiel #6
0
def ReportError(text, iid,
                clsid=None, helpfile=None, helpcontext=0, hresult=DISP_E_EXCEPTION):
    """Report a COM error.  Returns the passed in hresult value."""
    ei = CreateErrorInfo()
    ei.SetDescription(text)
    ei.SetGUID(iid)
    if helpfile is not None:
        ei.SetHelpFile(helpfile)
    if helpcontext is not None:
        ei.SetHelpContext(helpcontext)
    if clsid is not None:
        if isinstance(clsid, basestring):
            clsid = GUID(clsid)
        try:
            progid = clsid.as_progid()
        except WindowsError:
            pass
        else:
            ei.SetSource(progid) # progid for the class or application that created the error
    _oleaut32.SetErrorInfo(0, ei)
    return hresult
    def test_derived(self):
        # XXX leaks 50 refs
        self.failUnlessEqual(method_count(IUnknown), 3)

        class IMyInterface(IUnknown):
            pass

        self.failUnlessEqual(method_count(IMyInterface), 3)

        # assigning _methods_ does not work until we have an _iid_!
        self.assertRaises(AttributeError, setattr, IMyInterface, "_methods_", [])
        IMyInterface._iid_ = GUID.create_new()
        IMyInterface._methods_ = []
        self.failUnlessEqual(method_count(IMyInterface), 3)

        IMyInterface._methods_ = [STDMETHOD(HRESULT, "Blah", [])]
        self.failUnlessEqual(method_count(IMyInterface), 4)
Beispiel #8
0
class IDocHostUIHandler(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID("{BD3F23C0-D43E-11CF-893B-00AA00BDCE1A}")
    _idlflags_ = []
Beispiel #9
0
def ExecAs(scriptPath, asAdministrator, funcName, *args, **kwargs):
    pipeName = "\\\\.\\pipe\\" + str(GUID.create_new())
    Msg("creating named pipe")
    hPipe = CreateNamedPipe(
        pipeName,
        PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
        PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
        PIPE_UNLIMITED_INSTANCES,
        BUFSIZE,
        BUFSIZE,
        0,
        None
    )
    if hPipe == INVALID_HANDLE_VALUE:
        raise Exception("Error in creating Named Pipe")
    overlapped = OVERLAPPED()
    overlapped.hEvent = CreateEvent(None, 1, 0, None)
    try:
        Msg("calling ConnectNamedPipe")
        ConnectNamedPipe(hPipe, byref(overlapped))
        localPath = dirname(__file__.decode('mbcs'))
        Msg("starting subprocess")
        hProcess = RunAs(
            abspath(join(localPath, "..", "..", "EventGhost.exe")),
            asAdministrator,
            "-execfile",
            GetUncPathOf(join(localPath, "PipedProcessClient.py")),
            pipeName,
            str(eg.debugLevel)
        )
        Msg("waiting for subprocess to connect")
        pHandles = (HANDLE * 2)(overlapped.hEvent, hProcess)
        ret = WaitForMultipleObjects(2, pHandles, 0, 25000)
        if ret == WAIT_OBJECT_0:
            # connect event
            Msg("got connect event")
        elif ret == WAIT_OBJECT_0 + 1:
            raise Exception("Unexpected end of subprocess.")
        elif ret == WAIT_TIMEOUT:
            raise Exception("Timeout in waiting for subprocess.")
        else:
            raise Exception("Unknown return value")

        Msg("sending startup message")
        WritePipeMessage(
            hPipe,
            MESSAGE_ARGS,
            (GetUncPathOf(scriptPath), funcName, args, kwargs)
        )
        chBuf = create_string_buffer(BUFSIZE)
        cbRead = DWORD(0)
        while True:
            fSuccess = ReadFile(hPipe, chBuf, BUFSIZE, byref(cbRead), None)
            if ((fSuccess == 1) or (cbRead.value != 0)):
                code, data = loads(chBuf.value)
                if code == MESSAGE_STDERR:
                    sys.stderr.write(data)
                elif code == MESSAGE_STDOUT:
                    sys.stdout.write(data)
                elif code == MESSAGE_RESULT:
                    result = data
                    break
                elif code == MESSAGE_EXCEPTION:
                    break
                else:
                    raise Exception("Unknown message type %r" % code)
        FlushFileBuffers(hPipe)
        DisconnectNamedPipe(hPipe)
    finally:
        CloseHandle(hPipe)
        CloseHandle(overlapped.hEvent)
    if code == MESSAGE_EXCEPTION:
        raise Exception("Child process raised an exception\n" + data)
    return result
Beispiel #10
0
 def check(cls):
     try:
         GUID.from_progid(COM_CLASS)
         return True
     except comtypes.COMError:
         return False
Beispiel #11
0
class IDataObject(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID("{0000010E-0000-0000-C000-000000000046}")
    _idlflags_ = []
class IAudioEndpointVolume(IUnknown):
    _iid_ = GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}')
    _methods_ = (
        # HRESULT RegisterControlChangeNotify(
        # [in] IAudioEndpointVolumeCallback *pNotify);
        COMMETHOD([], HRESULT, 'RegisterControlChangeNotify',
                  (['in'], POINTER(IAudioEndpointVolumeCallback), 'pNotify')),
        # HRESULT UnregisterControlChangeNotify(
        # [in] IAudioEndpointVolumeCallback *pNotify);
        COMMETHOD([], HRESULT, 'UnregisterControlChangeNotify',
                  (['in'], POINTER(IAudioEndpointVolumeCallback), 'pNotify')),
        # HRESULT GetChannelCount([out] UINT *pnChannelCount);
        COMMETHOD([], HRESULT, 'GetChannelCount',
                  (['out'], POINTER(UINT), 'pnChannelCount')),
        # HRESULT SetMasterVolumeLevel(
        # [in] float fLevelDB, [in] LPCGUID pguidEventContext);
        COMMETHOD([], HRESULT, 'SetMasterVolumeLevel',
                  (['in'], c_float, 'fLevelDB'),
                  (['in'], POINTER(GUID), 'pguidEventContext')),
        # HRESULT SetMasterVolumeLevelScalar(
        # [in] float fLevel, [in] LPCGUID pguidEventContext);
        COMMETHOD([], HRESULT, 'SetMasterVolumeLevelScalar',
                  (['in'], c_float, 'fLevel'),
                  (['in'], POINTER(GUID), 'pguidEventContext')),
        # HRESULT GetMasterVolumeLevel([out] float *pfLevelDB);
        COMMETHOD([], HRESULT, 'GetMasterVolumeLevel',
                  (['out'], POINTER(c_float), 'pfLevelDB')),
        # HRESULT GetMasterVolumeLevelScalar([out] float *pfLevel);
        COMMETHOD([], HRESULT, 'GetMasterVolumeLevelScalar',
                  (['out'], POINTER(c_float), 'pfLevelDB')),
        # HRESULT SetChannelVolumeLevel(
        # [in] UINT nChannel,
        # [in] float fLevelDB,
        # [in] LPCGUID pguidEventContext);
        COMMETHOD([], HRESULT, 'SetChannelVolumeLevel',
                  (['in'], UINT, 'nChannel'), (['in'], c_float, 'fLevelDB'),
                  (['in'], POINTER(GUID), 'pguidEventContext')),
        # HRESULT SetChannelVolumeLevelScalar(
        # [in] UINT nChannel,
        # [in] float fLevel,
        # [in] LPCGUID pguidEventContext);
        COMMETHOD([], HRESULT, 'SetChannelVolumeLevelScalar',
                  (['in'], DWORD, 'nChannel'), (['in'], c_float, 'fLevelDB'),
                  (['in'], POINTER(GUID), 'pguidEventContext')),
        # HRESULT GetChannelVolumeLevel(
        # [in]  UINT nChannel,
        # [out] float *pfLevelDB);
        COMMETHOD([], HRESULT, 'GetChannelVolumeLevel',
                  (['in'], UINT, 'nChannel'),
                  (['out'], POINTER(c_float), 'pfLevelDB')),
        # HRESULT GetChannelVolumeLevelScalar(
        # [in]  UINT nChannel,
        # [out] float *pfLevel);
        COMMETHOD([], HRESULT, 'GetChannelVolumeLevelScalar',
                  (['in'], DWORD, 'nChannel'),
                  (['out'], POINTER(c_float), 'pfLevelDB')),
        # HRESULT SetMute([in] BOOL bMute, [in] LPCGUID pguidEventContext);
        COMMETHOD([], HRESULT, 'SetMute', (['in'], BOOL, 'bMute'),
                  (['in'], POINTER(GUID), 'pguidEventContext')),
        # HRESULT GetMute([out] BOOL *pbMute);
        COMMETHOD([], HRESULT, 'GetMute', (['out'], POINTER(BOOL), 'pbMute')),
        # HRESULT GetVolumeStepInfo(
        # [out] UINT *pnStep,
        # [out] UINT *pnStepCount);
        COMMETHOD([], HRESULT, 'GetVolumeStepInfo',
                  (['out'], POINTER(DWORD), 'pnStep'),
                  (['out'], POINTER(DWORD), 'pnStepCount')),
        # HRESULT VolumeStepUp([in] LPCGUID pguidEventContext);
        COMMETHOD([], HRESULT, 'VolumeStepUp',
                  (['in'], POINTER(GUID), 'pguidEventContext')),
        # HRESULT VolumeStepDown([in] LPCGUID pguidEventContext);
        COMMETHOD([], HRESULT, 'VolumeStepDown',
                  (['in'], POINTER(GUID), 'pguidEventContext')),
        # HRESULT QueryHardwareSupport([out] DWORD *pdwHardwareSupportMask);
        COMMETHOD([], HRESULT, 'QueryHardwareSupport',
                  (['out'], POINTER(DWORD), 'pdwHardwareSupportMask')),
        # HRESULT GetVolumeRange(
        # [out] float *pfLevelMinDB,
        # [out] float *pfLevelMaxDB,
        # [out] float *pfVolumeIncrementDB);
        COMMETHOD([], HRESULT, 'GetVolumeRange',
                  (['out'], POINTER(c_float), 'pfMin'),
                  (['out'], POINTER(c_float), 'pfMax'),
                  (['out'], POINTER(c_float), 'pfIncr')))
Beispiel #13
0
 class IDerived(IBase):
     _iid_ = GUID.create_new()
class IPicture(IUnknown):
    _case_insensitive_ = True
    'Picture Object'
    _iid_ = GUID('{7BF80980-BF32-101A-8BBB-00AA00300CAB}')
    _idlflags_ = ['hidden']
class _IPropertyStore(IUnknown):
    _case_insensitive_ = True
    u'Simple Property Store Interface'
    _iid_ = GUID('{886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99}')
    _idlflags_ = []
class IStorage(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{0000000B-0000-0000-C000-000000000046}')
    _idlflags_ = []
class IStream(ISequentialStream):
    _case_insensitive_ = True
    _iid_ = GUID('{0000000C-0000-0000-C000-000000000046}')
    _idlflags_ = []
class ISequentialStream(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{0C733A30-2A1C-11CE-ADE5-00AA0044773D}')
    _idlflags_ = []
Beispiel #19
0
from ctypes import (HRESULT, POINTER, Structure, Union, c_float, c_longlong, c_uint32, c_char_p)
from ctypes.wintypes import (BOOL, DWORD, INT, LONG, LPCWSTR, LPWSTR, UINT, ULARGE_INTEGER, VARIANT_BOOL, WORD)
from enum import Enum
import comtypes
import psutil
from comtypes import COMMETHOD, GUID, IUnknown
from comtypes.automation import VARTYPE, VT_BOOL, VT_CLSID, VT_LPWSTR, VT_UI4

POLICY_CONFIG_CLIENT_IID = GUID('{870AF99C-171D-4F9E-AF0D-E63DF40C2BC9}')
IPOLICY_CONFIG_X_IID = GUID('{8F9FB2AA-1C0B-4D54-B6BB-B2F2A10CE03C}')


class ERole(Enum):
    eConsole = 0
    eMultimedia = 1
    eCommunications = 2
    ERole_enum_count = 3


class IPolicyConfigX(IUnknown):
    _iid_ = IPOLICY_CONFIG_X_IID
    _methods_ = (
        # int SetDefaultEndpoint(
        #     [In] [MarshalAs(UnmanagedType.LPWStr)] string pszDeviceName,
        #     [In] [MarshalAs(UnmanagedType.U4)] ERole role);
        COMMETHOD([], HRESULT, 'SetDefaultEndpoint',
                  (['in'], LPWSTR, 'pszDeviceName'),
                  (['in'], c_uint32, 'role')),
    )

Beispiel #20
0
class IOleInPlaceFrame(IOleInPlaceUIWindow):
    _case_insensitive_ = True
    _iid_ = GUID("{00000116-0000-0000-C000-000000000046}")
    _idlflags_ = []
Beispiel #21
0
class IOleCommandTarget(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID("{B722BCCB-4E68-101B-A2BC-00AA00404770}")
    _idlflags_ = []
# This test requires that the Agilent IVI-COM Driver for Agilent546XX
# is installed.  It is not requires to have a physical instrument
# connected, the driver is used in simulation mode.
import unittest
from comtypes.test import ResourceDenied
from comtypes.client import CreateObject
from comtypes import GUID
from comtypes.safearray import _midlSAFEARRAY
from ctypes import c_double, POINTER

try:
    GUID.from_progid("Agilent546XX.Agilent546XX")
except WindowsError:
    pass

else:
    class Test(unittest.TestCase):
        def test(self):
            # The point of this test is the ReadWaveform method below,
            # which takes several [in, out] arguments.
            agDrvr = CreateObject("Agilent546XX.Agilent546XX")

            # XXX XXX XXX The following call crashes hard with an accessviolation when
            # the OANOCACHE environ variable is set.
            import os
            if "OANOCACHE" in os.environ:
                print "Cannot test. buggy COM object?"
                return

            # Initialize the driver in simulation mode.  Resource descriptor is ignored.
            agDrvr.Initialize("", False, False, "Simulate=true")
Beispiel #23
0
class IOleInPlaceActiveObject(IOleWindow):
    _case_insensitive_ = True
    _iid_ = GUID("{00000117-0000-0000-C000-000000000046}")
    _idlflags_ = []
class IEnumSTATSTG(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{0000000D-0000-0000-C000-000000000046}')
    _idlflags_ = []
Beispiel #25
0
 class IBase(IUnknown):
     _iid_ = GUID.create_new()
Beispiel #26
0
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
## LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
## OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
## WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

from ctypes import c_wchar_p, POINTER, byref, c_uint
from comtypes import COMObject, GUID
from comtypes.hresult import E_NOTIMPL, E_NOINTERFACE, S_OK
from comtypes.automation import *
from venster.windows import *

##CTYPES:
IID_NULL = GUID("{00000000-0000-0000-0000-000000000000}") #TODO move into ctypes

DISP_E_EXCEPTION = 0x80020009 #move into ctypes automation or?, (are from winerror.h)
DISP_E_MEMBERNOTFOUND = 0x80020003
DISP_E_BADINDEX = 0x8002000B
E_INVALID_ARG = 0x80070057

DISPID_PROPERTYPUT = -3


##CTYPES, should define a default factory
class Factory(object):
    def LockServer(self, arg, arg2):
        pass

class Invoker(object):
"""
Python wrapper around the Core Audio Windows API.
"""
from ctypes import (HRESULT, POINTER, Structure, Union, c_float, c_longlong,
                    c_uint32)
from ctypes.wintypes import (BOOL, DWORD, INT, LONG, LPCWSTR, LPWSTR, UINT,
                             ULARGE_INTEGER, VARIANT_BOOL, WORD)
from enum import Enum

import comtypes
import psutil
from comtypes import COMMETHOD, GUID, IUnknown
from comtypes.automation import VARTYPE, VT_BOOL, VT_CLSID, VT_LPWSTR, VT_UI4
from future.utils import python_2_unicode_compatible

IID_Empty = GUID('{00000000-0000-0000-0000-000000000000}')

CLSID_MMDeviceEnumerator = GUID('{BCDE0395-E52F-467C-8E3D-C4579291692E}')

UINT32 = c_uint32
REFERENCE_TIME = c_longlong


class PROPVARIANT_UNION(Union):
    _fields_ = [
        ('lVal', LONG),
        ('uhVal', ULARGE_INTEGER),
        ('boolVal', VARIANT_BOOL),
        ('pwszVal', LPWSTR),
        ('puuid', GUID),
    ]
Beispiel #28
0
class IIviDriverIdentity(IIviComponentIdentity):
    _case_insensitive_ = True
    'IVI Driver driver identity interface'
    _iid_ = GUID('{47ED5186-A398-11D4-BA58-000064657374}')
    _idlflags_ = ['oleautomation']
class StdFont(CoClass):
    _reg_clsid_ = GUID('{0BE35203-8F91-11CE-9DE3-00AA004BB851}')
    _idlflags_ = []
    _typelib_path_ = typelib_path
    _reg_typelib_ = ('{00020430-0000-0000-C000-000000000046}', 2, 0)
Beispiel #30
0
class IIviDriver(comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0.IUnknown):
    _case_insensitive_ = True
    'IVI Driver root interface'
    _iid_ = GUID('{47ED5184-A398-11D4-BA58-000064657374}')
    _idlflags_ = ['oleautomation']
import unittest
from ctypes import POINTER
from comtypes.automation import IDispatch
from comtypes.client import CreateObject
from comtypes import GUID

##from test import test_support
##from comtypes.unittests import support

try:
    GUID.from_progid("MSScriptControl.ScriptControl")
    CreateObject("MSScriptControl.ScriptControl")
except WindowsError:
    # doesn't exist on Windows CE or in 64-bit.
    pass
else:

    class Test(unittest.TestCase):
        def test_jscript(self):
            engine = CreateObject("MSScriptControl.ScriptControl")
            engine.Language = "JScript"
            # strange.
            #
            # engine.Eval returns a VARIANT containing a dispatch pointer.
            #
            # The dispatch pointer exposes this typeinfo (the number of
            # dispproperties varies, depending on the length of the list we pass
            # to Eval):
            #
            #class JScriptTypeInfo(comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0.IDispatch):
            #    'JScript Type Info'
Beispiel #32
0
	def _set_voice(self,val):
		try:
			val=GUID(val)
		except:
			val=self._enginesList[0].gModeID
		mode=None
		for mode in self._enginesList:
			if mode.gModeID==val:
				break
		if mode is None:
			raise ValueError("no such mode: %s"%val)
		self._currentMode=mode
		self._ttsAudio=CoCreateInstance(CLSID_MMAudioDest,IAudioMultiMediaDevice)
		self._ttsAudio.DeviceNumSet(nvwave.outputDeviceNameToID(config.conf["speech"]["outputDevice"], True))
		self._ttsCentral=POINTER(ITTSCentralW)()
		self._ttsEngines.Select(self._currentMode.gModeID,byref(self._ttsCentral),self._ttsAudio)
		self._ttsAttrs=self._ttsCentral.QueryInterface(ITTSAttributes)
		#Find out rate limits
		hasRate=bool(mode.dwFeatures&TTSFEATURE_SPEED)
		if hasRate:
			try:
				oldVal=DWORD()
				self._ttsAttrs.SpeedGet(byref(oldVal))
				self._ttsAttrs.SpeedSet(TTSATTR_MINSPEED)
				newVal=DWORD()
				self._ttsAttrs.SpeedGet(byref(newVal))
				self._minRate=newVal.value
				self._ttsAttrs.SpeedSet(TTSATTR_MAXSPEED)
				self._ttsAttrs.SpeedGet(byref(newVal))
				# ViaVoice (and perhaps other synths) doesn't seem to like the speed being set to maximum.
				self._maxRate=newVal.value-1
				self._ttsAttrs.SpeedSet(oldVal.value)
				if self._maxRate<=self._minRate:
					hasRate=False
			except COMError:
				hasRate=False
		if hasRate:
			if not self.isSupported('rate'):
				self.supportedSettings.insert(1,SynthDriver.RateSetting())
		else:
			if self.isSupported("rate"): self.removeSetting("rate")
		#Find out pitch limits
		hasPitch=bool(mode.dwFeatures&TTSFEATURE_PITCH)
		if hasPitch:
			try:
				oldVal=WORD()
				self._ttsAttrs.PitchGet(byref(oldVal))
				self._ttsAttrs.PitchSet(TTSATTR_MINPITCH)
				newVal=WORD()
				self._ttsAttrs.PitchGet(byref(newVal))
				self._minPitch=newVal.value
				self._ttsAttrs.PitchSet(TTSATTR_MAXPITCH)
				self._ttsAttrs.PitchGet(byref(newVal))
				self._maxPitch=newVal.value
				self._ttsAttrs.PitchSet(oldVal.value)
				if self._maxPitch<=self._minPitch:
					hasPitch=False
			except COMError:
				hasPitch=False
		if hasPitch:
			if not self.isSupported('pitch'):
				self.supportedSettings.insert(2,SynthDriver.PitchSetting())
		else:
			if self.isSupported('pitch'): self.removeSetting('pitch')
		#Find volume limits
		hasVolume=bool(mode.dwFeatures&TTSFEATURE_VOLUME)
		if hasVolume:
			try:
				oldVal=DWORD()
				self._ttsAttrs.VolumeGet(byref(oldVal))
				self._ttsAttrs.VolumeSet(TTSATTR_MINVOLUME)
				newVal=DWORD()
				self._ttsAttrs.VolumeGet(byref(newVal))
				self._minVolume=newVal.value
				self._ttsAttrs.VolumeSet(TTSATTR_MAXVOLUME)
				self._ttsAttrs.VolumeGet(byref(newVal))
				self._maxVolume=newVal.value
				self._ttsAttrs.VolumeSet(oldVal.value)
				if self._maxVolume<=self._minVolume:
					hasVolume=False
			except COMError:
				hasVolume=False
		if hasVolume:
			if not self.isSupported('volume'):
				self.supportedSettings.insert(3,SynthDriver.VolumeSetting())
		else:
			if self.isSupported('volume'): self.removeSetting('volume')
Beispiel #33
0
class IDropTarget(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID("{00000122-0000-0000-C000-000000000046}")
    _idlflags_ = []
Beispiel #34
0
	def check(cls):
		try:
			GUID.from_progid(COM_CLASS)
			return True
		except WindowsError:
			return False
 def QueryPathOfRegTypeLib(libid, wVerMajor, wVerMinor, lcid=0):
     "Return the path of a registered type library"
     pathname = BSTR()
     _oleaut32.QueryPathOfRegTypeLib(byref(GUID(libid)), wVerMajor,
                                     wVerMinor, lcid, byref(pathname))
     return pathname.value.split("\0")[0]
class Font(IDispatch):
    _case_insensitive_ = True
    _iid_ = GUID('{BEF6E003-A874-101A-8BBA-00AA00300CAB}')
    _idlflags_ = []
    _methods_ = []
Beispiel #37
0
class ICustomDoc(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID("{3050F3F0-98B5-11CF-BB82-00AA00BDCE0B}")
    _idlflags_ = []
class Picture(IDispatch):
    _case_insensitive_ = True
    _iid_ = GUID('{7BF80981-BF32-101A-8BBB-00AA00300CAB}')
    _idlflags_ = []
    _methods_ = []
class FontEvents(IDispatch):
    _case_insensitive_ = True
    'Event interface for the Font object'
    _iid_ = GUID('{4EF6100A-AF88-11D0-9846-00C04FC29993}')
    _idlflags_ = ['hidden']
    _methods_ = []
Beispiel #40
0
class IOleWindow(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID("{00000114-0000-0000-C000-000000000046}")
    _idlflags_ = []
class IFont(IUnknown):
    _case_insensitive_ = True
    'Font Object'
    _iid_ = GUID('{BEF6E002-A874-101A-8BBA-00AA00300CAB}')
    _idlflags_ = ['hidden']
def UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid=0, syskind=SYS_WIN32):
    "Unregister a registered type library"
    return _oleaut32.UnRegisterTypeLib(byref(GUID(libID)), wVerMajor,
                                       wVerMinor, lcid, syskind)