Thinkai's Blog

Autohotkey|Python|php|aardio|VOIP|IT 爱好者

正在浏览分类 Autohotkey

总共找到 128 篇

JSON POST Autohotkey 3518

作者为 发表

Autohotkey

JSONPOST(url, Encoding = "",postData=""){ ;网址,编码, post JSON数据
	hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
	Try
	{
		hObject.Open("POST",url,False)
		hObject.SetRequestHeader("Content-Type", "application/json")
		hObject.Send(postData)
	}
	catch e
		return -1

	if (Encoding && hObject.ResponseBody)
	{
		oADO := ComObjCreate("adodb.stream")
		oADO.Type := 1
		oADO.Mode := 3
		oADO.Open()
		oADO.Write(hObject.ResponseBody)
		oADO.Position := 0
		oADO.Type := 2
		oADO.Charset := Encoding
		return oADO.ReadText(), oADO.Close()
	}
	return hObject.ResponseText
}


获取生成32位UUID GUID Autohotkey 4589

作者为 发表

Autohotkey

;生成32位UUID
GUID(){
	shellobj := ComObjCreate("Scriptlet.TypeLib")
	ret := shellobj.GUID
	uuid := RegExReplace(ret,"(\{|\}|-)","") ;去掉花括号和-
	return uuid
}


生成随机时间 日期加减 Autohotkey 4598

作者为 发表

Autohotkey

MsgBox % GenTime()


;生成随机时间 前1小时-前三天内
GenTime(){
	FormatTime, outdate, % Time_unix2human(Time_human2unix(A_Now)+rand(28800,35000)), yyyy-MM-dd HH:mm:ss
	return outdate
}


rand(min,max){ ;随机函数
	Random, out, % min, max
	return out
}

;unix时间戳转换函数
Time_unix2human(time)
{
        human=19700101000000
        time-=((A_NowUTC-A_Now)//10000)*3600        ;时差
        human+=%time%,Seconds
        return human
        }
Time_human2unix(time)
{
        time-=19700101000000,Seconds
        time+=((A_NowUTC-A_Now)//10000)*3600        ;时差
        return time
}


图灵机器人文字聊天Demo Autohotkey 3832

作者为 发表

Autohotkey

api := "http://www.tuling123.com/openapi/api"
key := "aeaca4b118ae2d0802a214f5ca6cdaf3"
userid := "666666"
Gui, Add, Edit, x0 y0 w400 h400 ReadOnly vlog
Gui, Add, Edit, x0 y400 w400 h100 vwrite
Gui, Add, Button, x300 y500 w80 h20 gsend Default, 发送
Gui, +hwndmainhwnd
Gui, Show, , 图灵文字测试
return

GuiClose:
ExitApp

#If WinActive("ahk_id " mainhwnd)
$Enter::
goto, send
return

^Enter::
ControlSend, Edit2, {Enter}, ahk_id %mainhwnd%
#if

send:
Gui, Submit, NoHide
if write
{
	AddText(write,"我")
	GuiControl, , write, % ""

	if A_IsUnicode
	{
		msg := {"key":key,"info":write,"userid":userid}
		json_msg := json_fromobj(msg)
	}
	else
		json_msg := "{""key"":""" key """,""info"":""" write """,""userid"":" userid "}"
	;AddText(json_msg,"SendJSON")
	ret := HTTPPOST(api, "UTF-8", json_msg)
	;AddText(ret,"系统")
	if (ret<>-1)
	{
		retobj := json_toobj(ret)
		if (retobj.code="100000") ;文字
			AddText(retobj.text,"图灵")
		else if (retobj.code="200000") ;链接类
			AddText(retobj.text "`n" retobj.url,"图灵")
		else if (retobj.code="302000") ;新闻类
		{
			news := ""
			for k,v in retobj.list
				news .= "【" v.source "】" v.article " " v.detailurl "`n"
			AddText(retobj.text "`n" news,"图灵")
		}
		else if (retobj.code="308000") ;菜谱类
		{
			cb := ""
			for k,v in retobj.list
				cb .= "【" v.name "】" v.info " " v.detailurl "`n"
			AddText(retobj.text "`n" cb,"图灵")
		}
		else
			AddText(retobj.code ":" retobj.text,"图灵")
	}
}


return

AddText(text,person){
	global log, mainhwnd
	GuiControlGet, log
	GuiControl, , log, % log "`n`n" person " (" A_Hour ":" A_Min ":" A_Sec ")`n" text
	ControlFocus, Edit2, ahk_id %mainhwnd%
	ControlSend, Edit1, {PGDN 3}, ahk_id %mainhwnd%
}


HTTPPOST(url, Encoding = "",postData=""){ ;网址,编码,请求方式,post数据
	hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")

	Try
	{
		hObject.Open("POST",url,False)
		hObject.SetRequestHeader("Content-Type", "application/json")
		hObject.Send(postData)
	}
	catch e
		return -1

	if (Encoding && hObject.ResponseBody)
	{
		oADO := ComObjCreate("adodb.stream")
		oADO.Type := 1
		oADO.Mode := 3
		oADO.Open()
		oADO.Write(hObject.ResponseBody)
		oADO.Position := 0
		oADO.Type := 2
		oADO.Charset := Encoding
		return oADO.ReadText(), oADO.Close()
	}
	return hObject.ResponseText
}

需要如下函数,请从往期文章查找:

json_fromobj(obj)

json_toobj(str)

Ansi2UTF8(sString)

UTF82Ansi(zString)

Ansi2Unicode(ByRef sString, ByRef wString, CP = 0)

Unicode2Ansi(ByRef wString, ByRef sString, CP = 0)

RegRead, var, HKCU, Software\Microsoft\Windows\CurrentVersion\Run, SetIP
last := A_LastError
if last=2
	RegWrite, REG_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Run, SetIP, "%A_ScriptFullPath%"

mac := GetMacAddress()
mac2 := RegExReplace(mac,"-",":")

IfExist, %A_ScriptDir%\ipinfo.ini
{
	IniRead, ip, %A_ScriptDir%\ipinfo.ini, ipinfo, ip
	IniRead, netmask, %A_ScriptDir%\ipinfo.ini, ipinfo, netmask
	IniRead, gateway, %A_ScriptDir%\ipinfo.ini, ipinfo, gateway
	IniRead, dns, %A_ScriptDir%\ipinfo.ini, ipinfo, dns
}
else
{
	MsgBox, 4112, 错误, %A_ScriptDir%\ipinfo.ini 文件不存在,已生成,请修改后再使用!
	IniWrite, ip, %A_ScriptDir%\ipinfo.ini, ipinfo, ip
	IniWrite, 子网掩码, %A_ScriptDir%\ipinfo.ini, ipinfo, netmask
	IniWrite, 默认网关, %A_ScriptDir%\ipinfo.ini, ipinfo, gateway
	IniWrite, dns, %A_ScriptDir%\ipinfo.ini, ipinfo, dns
	ExitApp
}

adaptors := GetAdaptors()
for id,adaptor in adaptors
{
	if(adaptor.mac = mac2)
	{
		name := adaptor.name
		Clipboard = netsh interface ip set address name=`"%name%`" source=static addr=%ip% mask=%netmask% gateway=%gateway% gwmetric=1
		Runwait, %ComSpec% /c netsh interface ip set address name=`"%name%`" source=static addr=%ip% mask=%netmask% gateway=%gateway% gwmetric=1, , Hide
		RunWait, %ComSpec% /c netsh interface ip set dns name=`"%name%`" source=static addr=%dns%, ,Hide
	}
}


GetAdaptors(){
    adaptors := {}
	ipconfig := cmd("ipconfig /all")
	lines := StrSplit(ipconfig,"`n","`r")
	aid = 0
	for id,line in Lines
	{
		if (!RegExMatch(line,"^\s*$"))
		{
			if RegExMatch(line, "^.*(适配器|adapter)\s([^\s].*):$", mn)
			{
				aid++
				adaptors[aid] := {}
				adaptors[aid].name := mn2
			}
			Else
			{
				if RegExMatch(line, "^.*(物理地址|Physical Address).*:\s(\w{2})-(\w{2})-(\w{2})-(\w{2})-(\w{2})-(\w{2})$", mm)
					adaptors[aid].mac := mm2 ":" mm3 ":" mm4 ":" mm5 ":" mm6 ":" mm7
			}
		}
	}

	/* ;xp不适用
    objWMIService := ComObjGet("winmgmts:{impersonationLevel = impersonate}!\\.\root\cimv2")
    for objItem in objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE (MACAddress IS NOT NULL)  AND (NetConnectionStatus >0)")
    {
        adaptors.Insert({"name":objItem.NetConnectionID,"InterfaceIndex":objItem.InterfaceIndex,"GUID":objItem.GUID})
        colItems2 := objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE InterfaceIndex = '" adaptors[A_index].InterfaceIndex "'")._NewEnum, colItems2[objItem2]
        adaptors[A_index].DHCPEnabled := Abs(objItem2.DHCPEnabled)
        adaptors[A_index].IPAddress := objItem2.IPAddress[0]
        adaptors[A_index].IPSubnet := objItem2.IPSubnet[0]
        adaptors[A_index].DefaultIPGateway := objItem2.DefaultIPGateway[0]
        adaptors[A_index].DNSServerSearchOrder := objItem2.DNSServerSearchOrder[0]
        adaptors[A_index].MACAddress := objItem2.MACAddress
    }
    return adaptors
	*/
	return adaptors
}

GetMacAddress(){
	res := cmd("getmac /NH")
	RegExMatch(res, ".*?([0-9A-Z].{16})(?!\w\\Device)", mac)
	return %mac1%
}


cmd(sCmd, sEncoding:="CP0", sDir:="", ByRef nExitCode:=0) {
    DllCall( "CreatePipe",           PtrP,hStdOutRd, PtrP,hStdOutWr, Ptr,0, UInt,0 )
    DllCall( "SetHandleInformation", Ptr,hStdOutWr, UInt,1, UInt,1                 )

            VarSetCapacity( pi, (A_PtrSize == 4) ? 16 : 24,  0 )
    siSz := VarSetCapacity( si, (A_PtrSize == 4) ? 68 : 104, 0 )
    NumPut( siSz,      si,  0,                          "UInt" )
    NumPut( 0x100,     si,  (A_PtrSize == 4) ? 44 : 60, "UInt" )
    NumPut( hStdOutWr, si,  (A_PtrSize == 4) ? 60 : 88, "Ptr"  )
    NumPut( hStdOutWr, si,  (A_PtrSize == 4) ? 64 : 96, "Ptr"  )

    If ( !DllCall( "CreateProcess", Ptr,0, Ptr,&sCmd, Ptr,0, Ptr,0, Int,True, UInt,0x08000000
                                  , Ptr,0, Ptr,sDir?&sDir:0, Ptr,&si, Ptr,&pi ) )
        Return ""
      , DllCall( "CloseHandle", Ptr,hStdOutWr )
      , DllCall( "CloseHandle", Ptr,hStdOutRd )

    DllCall( "CloseHandle", Ptr,hStdOutWr ) ; The write pipe must be closed before reading the stdout.
    While ( 1 )
    { ; Before reading, we check if the pipe has been written to, so we avoid freezings.
        If ( !DllCall( "PeekNamedPipe", Ptr,hStdOutRd, Ptr,0, UInt,0, Ptr,0, UIntP,nTot, Ptr,0 ) )
            Break
        If ( !nTot )
        { ; If the pipe buffer is empty, sleep and continue checking.
            Sleep, 100
            Continue
        } ; Pipe buffer is not empty, so we can read it.
        VarSetCapacity(sTemp, nTot+1)
        DllCall( "ReadFile", Ptr,hStdOutRd, Ptr,&sTemp, UInt,nTot, PtrP,nSize, Ptr,0 )
        sOutput .= StrGet(&sTemp, nSize, sEncoding)
    }

    ; * SKAN has managed the exit code through SetLastError.
    DllCall( "GetExitCodeProcess", Ptr,NumGet(pi,0), UIntP,nExitCode )
    DllCall( "CloseHandle",        Ptr,NumGet(pi,0)                  )
    DllCall( "CloseHandle",        Ptr,NumGet(pi,A_PtrSize)          )
    DllCall( "CloseHandle",        Ptr,hStdOutRd                     )
    Return sOutput
}


示例:

;朗读CMD传入的字符串
#SingleInstance Off
#NoTrayIcon
tts := ComObjCreate("SAPI.SpVoice")
tts.Voice := tts.GetVoices("Name=VW Hui").Item(0) ;把发音人设置成名称为VW Hui的
tts.Rate := 3 ;说话速度 -10到10
tts.Volume := 100 ;音量 0到100
txt = %1%
tts.Speak(txt) ;开始朗读

IDL接口文档:

// Generated .IDL file (by the OLE/COM Object Viewer)
// 
// typelib filename: sapi.dll

[
  uuid(C866CA3A-32F7-11D2-9602-00C04F8EE628),
  version(5.4),
  helpstring("Microsoft Speech Object Library")
]
library SpeechLib
{
    // TLib :     // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
    importlib("stdole2.tlb");

    // Forward declare all types defined in this typelib
    interface ISpeechDataKey;
    interface ISpeechObjectToken;
    interface ISpeechObjectTokenCategory;
    interface ISpeechObjectTokens;
    interface ISpeechAudioBufferInfo;
    interface ISpeechAudioStatus;
    interface ISpeechAudioFormat;
    interface ISpeechWaveFormatEx;
    interface ISpeechBaseStream;
    interface ISpeechFileStream;
    interface ISpeechMemoryStream;
    interface ISpeechCustomStream;
    interface ISpeechAudio;
    interface ISpeechMMSysAudio;
    interface ISpeechVoice;
    interface ISpeechVoiceStatus;
    dispinterface _ISpeechVoiceEvents;
    interface ISpeechRecognizer;
    interface ISpeechRecognizerStatus;
    interface ISpeechRecoContext;
    interface ISpeechRecoGrammar;
    interface ISpeechGrammarRules;
    interface ISpeechGrammarRule;
    interface ISpeechGrammarRuleState;
    interface ISpeechGrammarRuleStateTransitions;
    interface ISpeechGrammarRuleStateTransition;
    interface ISpeechTextSelectionInformation;
    interface ISpeechRecoResult;
    interface ISpeechRecoResultTimes;
    interface ISpeechPhraseInfo;
    interface ISpeechPhraseRule;
    interface ISpeechPhraseRules;
    interface ISpeechPhraseProperties;
    interface ISpeechPhraseProperty;
    interface ISpeechPhraseElements;
    interface ISpeechPhraseElement;
    interface ISpeechPhraseReplacements;
    interface ISpeechPhraseReplacement;
    interface ISpeechPhraseAlternates;
    interface ISpeechPhraseAlternate;
    dispinterface _ISpeechRecoContextEvents;
    interface ISpeechRecoResult2;
    interface ISpeechLexicon;
    interface ISpeechLexiconWords;
    interface ISpeechLexiconWord;
    interface ISpeechLexiconPronunciations;
    interface ISpeechLexiconPronunciation;
    interface ISpeechXMLRecoResult;
    interface ISpeechRecoResultDispatch;
    interface ISpeechPhraseInfoBuilder;
    interface ISpeechPhoneConverter;
    interface ISpNotifyTranslator;
    interface ISpNotifySink;
    interface ISpObjectTokenCategory;
    interface ISpDataKey;
    interface IEnumSpObjectTokens;
    interface ISpObjectToken;
    interface ISpResourceManager;
    interface IServiceProvider;
    interface ISpStreamFormatConverter;
    interface ISpStreamFormat;
    interface IStream;
    interface ISequentialStream;
    interface ISpEventSource;
    interface ISpNotifySource;
    interface ISpEventSink;
    interface ISpObjectWithToken;
    interface ISpMMSysAudio;
    interface ISpAudio;
    interface ISpStream;
    interface ISpVoice;
    interface ISpPhoneticAlphabetSelection;
    interface ISpRecoContext;
    interface ISpRecognizer;
    interface ISpProperties;
    interface ISpPhrase;
    interface ISpRecoGrammar;
    interface ISpGrammarBuilder;
    interface ISpRecoResult;
    interface ISpPhraseAlt;
    interface ISpRecoContext2;
    interface ISpRecognizer2;
    interface ISpRecognizer3;
    interface ISpRecoCategory;
    interface ISpSerializeState;
    interface ISpLexicon;
    interface ISpShortcut;
    interface ISpPhoneConverter;
    interface ISpPhoneticAlphabetConverter;
    interface ISpXMLRecoResult;
    interface ISpRecoGrammar2;
    interface ISpeechResourceLoader;
    interface IInternetSecurityManager;
    interface IInternetSecurityMgrSite;
    interface IEnumString;

    [
      odl,
      uuid(CE17C09B-4EFA-44D5-A4C9-59D9585AB0CD),
      helpstring("ISpeechDataKey Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechDataKey : IDispatch {
        [id(0x00000001), helpstring("SetBinaryValue")]
        HRESULT SetBinaryValue(
                        [in] BSTR ValueName, 
                        [in] VARIANT Value);
        [id(0x00000002), helpstring("GetBinaryValue")]
        HRESULT GetBinaryValue(
                        [in] BSTR ValueName, 
                        [out, retval] VARIANT* Value);
        [id(0x00000003), helpstring("SetStringValue")]
        HRESULT SetStringValue(
                        [in] BSTR ValueName, 
                        [in] BSTR Value);
        [id(0x00000004), helpstring("GetStringValue")]
        HRESULT GetStringValue(
                        [in] BSTR ValueName, 
                        [out, retval] BSTR* Value);
        [id(0x00000005), helpstring("SetLongValue")]
        HRESULT SetLongValue(
                        [in] BSTR ValueName, 
                        [in] long Value);
        [id(0x00000006), helpstring("GetlongValue")]
        HRESULT GetLongValue(
                        [in] BSTR ValueName, 
                        [out, retval] long* Value);
        [id(0x00000007), helpstring("OpenKey")]
        HRESULT OpenKey(
                        [in] BSTR SubKeyName, 
                        [out, retval] ISpeechDataKey** SubKey);
        [id(0x00000008), helpstring("CreateKey")]
        HRESULT CreateKey(
                        [in] BSTR SubKeyName, 
                        [out, retval] ISpeechDataKey** SubKey);
        [id(0x00000009), helpstring("DeleteKey")]
        HRESULT DeleteKey([in] BSTR SubKeyName);
        [id(0x0000000a), helpstring("DeleteValue")]
        HRESULT DeleteValue([in] BSTR ValueName);
        [id(0x0000000b), helpstring("EnumKeys")]
        HRESULT EnumKeys(
                        [in] long Index, 
                        [out, retval] BSTR* SubKeyName);
        [id(0x0000000c), helpstring("EnumValues")]
        HRESULT EnumValues(
                        [in] long Index, 
                        [out, retval] BSTR* ValueName);
    };

    [
      odl,
      uuid(C74A3ADC-B727-4500-A84A-B526721C8B8C),
      helpstring("ISpeechObjectToken Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechObjectToken : IDispatch {
        [id(0x00000001), propget, helpstring("Id")]
        HRESULT Id([out, retval] BSTR* ObjectId);
        [id(0x00000002), propget, hidden, helpstring("DataKey")]
        HRESULT DataKey([out, retval] ISpeechDataKey** DataKey);
        [id(0x00000003), propget, helpstring("Category")]
        HRESULT Category([out, retval] ISpeechObjectTokenCategory** Category);
        [id(0x00000004), helpstring("GetDescription")]
        HRESULT GetDescription(
                        [in, optional, defaultvalue(0)] long Locale, 
                        [out, retval] BSTR* Description);
        [id(0x00000005), hidden, helpstring("SetId")]
        HRESULT SetId(
                        [in] BSTR Id, 
                        [in, optional, defaultvalue("")] BSTR CategoryID, 
                        [in, optional, defaultvalue(0)] VARIANT_BOOL CreateIfNotExist);
        [id(0x00000006), helpstring("GetAttribute")]
        HRESULT GetAttribute(
                        [in] BSTR AttributeName, 
                        [out, retval] BSTR* AttributeValue);
        [id(0x00000007), helpstring("CreateInstance")]
        HRESULT CreateInstance(
                        [in, optional, defaultvalue(<unprintable IUnknown*>)] IUnknown* pUnkOuter, 
                        [in, optional, defaultvalue(23)] SpeechTokenContext ClsContext, 
                        [out, retval] IUnknown** Object);
        [id(0x00000008), hidden, helpstring("Remove")]
        HRESULT Remove([in] BSTR ObjectStorageCLSID);
        [id(0x00000009), hidden, helpstring("GetStorageFileName")]
        HRESULT GetStorageFileName(
                        [in] BSTR ObjectStorageCLSID, 
                        [in] BSTR KeyName, 
                        [in] BSTR FileName, 
                        [in] SpeechTokenShellFolder Folder, 
                        [out, retval] BSTR* FilePath);
        [id(0x0000000a), hidden, helpstring("RemoveStorageFileName")]
        HRESULT RemoveStorageFileName(
                        [in] BSTR ObjectStorageCLSID, 
                        [in] BSTR KeyName, 
                        [in] VARIANT_BOOL DeleteFile);
        [id(0x0000000b), hidden, helpstring("IsUISupported")]
        HRESULT IsUISupported(
                        [in] BSTR TypeOfUI, 
                        [in, optional, defaultvalue("")] VARIANT* ExtraData, 
                        [in, optional, defaultvalue(<unprintable IUnknown*>)] IUnknown* Object, 
                        [out, retval] VARIANT_BOOL* Supported);
        [id(0x0000000c), hidden, helpstring("DisplayUI")]
        HRESULT DisplayUI(
                        [in] long hWnd, 
                        [in] BSTR Title, 
                        [in] BSTR TypeOfUI, 
                        [in, optional, defaultvalue("")] VARIANT* ExtraData, 
                        [in, optional, defaultvalue(<unprintable IUnknown*>)] IUnknown* Object);
        [id(0x0000000d), helpstring("MatchesAttributes")]
        HRESULT MatchesAttributes(
                        [in] BSTR Attributes, 
                        [out, retval] VARIANT_BOOL* Matches);
    };

    [
      odl,
      uuid(CA7EAC50-2D01-4145-86D4-5AE7D70F4469),
      helpstring("ISpeechObjectTokenCategory Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechObjectTokenCategory : IDispatch {
        [id(0x00000001), propget, helpstring("Id")]
        HRESULT Id([out, retval] BSTR* Id);
        [id(0x00000002), propput, helpstring("Default")]
        HRESULT Default([in] BSTR TokenId);
        [id(0x00000002), propget, helpstring("Default")]
        HRESULT Default([out, retval] BSTR* TokenId);
        [id(0x00000003), helpstring("SetId")]
        HRESULT SetId(
                        [in] BSTR Id, 
                        [in, optional, defaultvalue(0)] VARIANT_BOOL CreateIfNotExist);
        [id(0x00000004), hidden, helpstring("GetDataKey")]
        HRESULT GetDataKey(
                        [in, optional, defaultvalue(0)] SpeechDataKeyLocation Location, 
                        [out, retval] ISpeechDataKey** DataKey);
        [id(0x00000005), helpstring("EnumerateTokens")]
        HRESULT EnumerateTokens(
                        [in, optional, defaultvalue("")] BSTR RequiredAttributes, 
                        [in, optional, defaultvalue("")] BSTR OptionalAttributes, 
                        [out, retval] ISpeechObjectTokens** Tokens);
    };

    typedef enum {
        SDKLDefaultLocation = 0,
        SDKLCurrentUser = 1,
        SDKLLocalMachine = 2,
        SDKLCurrentConfig = 5
    } SpeechDataKeyLocation;

    [
      odl,
      uuid(9285B776-2E7B-4BC0-B53E-580EB6FA967F),
      helpstring("ISpeechObjectTokens Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechObjectTokens : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechObjectToken** Token);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the tokens")]
        HRESULT _NewEnum([out, retval] IUnknown** ppEnumVARIANT);
    };

    typedef enum {
        STCInprocServer = 1,
        STCInprocHandler = 2,
        STCLocalServer = 4,
        STCRemoteServer = 16,
        STCAll = 23
    } SpeechTokenContext;

    typedef enum {
        STSF_AppData = 26,
        STSF_LocalAppData = 28,
        STSF_CommonAppData = 35,
        STSF_FlagCreate = 32768
    } SpeechTokenShellFolder;

    [
      odl,
      uuid(11B103D8-1142-4EDF-A093-82FB3915F8CC),
      helpstring("ISpeechAudioBufferInfo Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechAudioBufferInfo : IDispatch {
        [id(0x00000001), propget, helpstring("MinNotification")]
        HRESULT MinNotification([out, retval] long* MinNotification);
        [id(0x00000001), propput, helpstring("MinNotification")]
        HRESULT MinNotification([in] long MinNotification);
        [id(0x00000002), propget, helpstring("BufferSize")]
        HRESULT BufferSize([out, retval] long* BufferSize);
        [id(0x00000002), propput, helpstring("BufferSize")]
        HRESULT BufferSize([in] long BufferSize);
        [id(0x00000003), propget, helpstring("EventBias")]
        HRESULT EventBias([out, retval] long* EventBias);
        [id(0x00000003), propput, helpstring("EventBias")]
        HRESULT EventBias([in] long EventBias);
    };

    [
      odl,
      uuid(C62D9C91-7458-47F6-862D-1EF86FB0B278),
      helpstring("ISpeechAudioStatus Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechAudioStatus : IDispatch {
        [id(0x00000001), propget, helpstring("FreeBufferSpace")]
        HRESULT FreeBufferSpace([out, retval] long* FreeBufferSpace);
        [id(0x00000002), propget, helpstring("NonBlockingIO")]
        HRESULT NonBlockingIO([out, retval] long* NonBlockingIO);
        [id(0x00000003), propget, helpstring("State")]
        HRESULT State([out, retval] SpeechAudioState* State);
        [id(0x00000004), propget, helpstring("CurrentSeekPosition")]
        HRESULT CurrentSeekPosition([out, retval] VARIANT* CurrentSeekPosition);
        [id(0x00000005), propget, helpstring("CurrentDevicePosition")]
        HRESULT CurrentDevicePosition([out, retval] VARIANT* CurrentDevicePosition);
    };

    typedef enum {
        SASClosed = 0,
        SASStop = 1,
        SASPause = 2,
        SASRun = 3
    } SpeechAudioState;

    [
      odl,
      uuid(E6E9C590-3E18-40E3-8299-061F98BDE7C7),
      helpstring("ISpeechAudioFormat Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechAudioFormat : IDispatch {
        [id(0x00000001), propget, helpstring("Type")]
        HRESULT Type([out, retval] SpeechAudioFormatType* AudioFormat);
        [id(0x00000001), propput, helpstring("Type")]
        HRESULT Type([in] SpeechAudioFormatType AudioFormat);
        [id(0x00000002), propget, hidden, helpstring("Guid")]
        HRESULT Guid([out, retval] BSTR* Guid);
        [id(0x00000002), propput, hidden, helpstring("Guid")]
        HRESULT Guid([in] BSTR Guid);
        [id(0x00000003), hidden, helpstring("GetWaveFormatEx")]
        HRESULT GetWaveFormatEx([out, retval] ISpeechWaveFormatEx** SpeechWaveFormatEx);
        [id(0x00000004), hidden, helpstring("SetWaveFormatEx")]
        HRESULT SetWaveFormatEx([in] ISpeechWaveFormatEx* SpeechWaveFormatEx);
    };

    typedef enum {
        SAFTDefault = 0xffffffff,
        SAFTNoAssignedFormat = 0,
        SAFTText = 1,
        SAFTNonStandardFormat = 2,
        SAFTExtendedAudioFormat = 3,
        SAFT8kHz8BitMono = 4,
        SAFT8kHz8BitStereo = 5,
        SAFT8kHz16BitMono = 6,
        SAFT8kHz16BitStereo = 7,
        SAFT11kHz8BitMono = 8,
        SAFT11kHz8BitStereo = 9,
        SAFT11kHz16BitMono = 10,
        SAFT11kHz16BitStereo = 11,
        SAFT12kHz8BitMono = 12,
        SAFT12kHz8BitStereo = 13,
        SAFT12kHz16BitMono = 14,
        SAFT12kHz16BitStereo = 15,
        SAFT16kHz8BitMono = 16,
        SAFT16kHz8BitStereo = 17,
        SAFT16kHz16BitMono = 18,
        SAFT16kHz16BitStereo = 19,
        SAFT22kHz8BitMono = 20,
        SAFT22kHz8BitStereo = 21,
        SAFT22kHz16BitMono = 22,
        SAFT22kHz16BitStereo = 23,
        SAFT24kHz8BitMono = 24,
        SAFT24kHz8BitStereo = 25,
        SAFT24kHz16BitMono = 26,
        SAFT24kHz16BitStereo = 27,
        SAFT32kHz8BitMono = 28,
        SAFT32kHz8BitStereo = 29,
        SAFT32kHz16BitMono = 30,
        SAFT32kHz16BitStereo = 31,
        SAFT44kHz8BitMono = 32,
        SAFT44kHz8BitStereo = 33,
        SAFT44kHz16BitMono = 34,
        SAFT44kHz16BitStereo = 35,
        SAFT48kHz8BitMono = 36,
        SAFT48kHz8BitStereo = 37,
        SAFT48kHz16BitMono = 38,
        SAFT48kHz16BitStereo = 39,
        SAFTTrueSpeech_8kHz1BitMono = 40,
        SAFTCCITT_ALaw_8kHzMono = 41,
        SAFTCCITT_ALaw_8kHzStereo = 42,
        SAFTCCITT_ALaw_11kHzMono = 43,
        SAFTCCITT_ALaw_11kHzStereo = 44,
        SAFTCCITT_ALaw_22kHzMono = 45,
        SAFTCCITT_ALaw_22kHzStereo = 46,
        SAFTCCITT_ALaw_44kHzMono = 47,
        SAFTCCITT_ALaw_44kHzStereo = 48,
        SAFTCCITT_uLaw_8kHzMono = 49,
        SAFTCCITT_uLaw_8kHzStereo = 50,
        SAFTCCITT_uLaw_11kHzMono = 51,
        SAFTCCITT_uLaw_11kHzStereo = 52,
        SAFTCCITT_uLaw_22kHzMono = 53,
        SAFTCCITT_uLaw_22kHzStereo = 54,
        SAFTCCITT_uLaw_44kHzMono = 55,
        SAFTCCITT_uLaw_44kHzStereo = 56,
        SAFTADPCM_8kHzMono = 57,
        SAFTADPCM_8kHzStereo = 58,
        SAFTADPCM_11kHzMono = 59,
        SAFTADPCM_11kHzStereo = 60,
        SAFTADPCM_22kHzMono = 61,
        SAFTADPCM_22kHzStereo = 62,
        SAFTADPCM_44kHzMono = 63,
        SAFTADPCM_44kHzStereo = 64,
        SAFTGSM610_8kHzMono = 65,
        SAFTGSM610_11kHzMono = 66,
        SAFTGSM610_22kHzMono = 67,
        SAFTGSM610_44kHzMono = 68
    } SpeechAudioFormatType;

    [
      odl,
      uuid(7A1EF0D5-1581-4741-88E4-209A49F11A10),
      helpstring("ISpeechWaveFormatEx Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechWaveFormatEx : IDispatch {
        [id(0x00000001), propget, helpstring("FormatTag")]
        HRESULT FormatTag([out, retval] short* FormatTag);
        [id(0x00000001), propput, helpstring("FormatTag")]
        HRESULT FormatTag([in] short FormatTag);
        [id(0x00000002), propget, helpstring("Channels")]
        HRESULT Channels([out, retval] short* Channels);
        [id(0x00000002), propput, helpstring("Channels")]
        HRESULT Channels([in] short Channels);
        [id(0x00000003), propget, helpstring("SamplesPerSec")]
        HRESULT SamplesPerSec([out, retval] long* SamplesPerSec);
        [id(0x00000003), propput, helpstring("SamplesPerSec")]
        HRESULT SamplesPerSec([in] long SamplesPerSec);
        [id(0x00000004), propget, helpstring("AvgBytesPerSec")]
        HRESULT AvgBytesPerSec([out, retval] long* AvgBytesPerSec);
        [id(0x00000004), propput, helpstring("AvgBytesPerSec")]
        HRESULT AvgBytesPerSec([in] long AvgBytesPerSec);
        [id(0x00000005), propget, helpstring("BlockAlign")]
        HRESULT BlockAlign([out, retval] short* BlockAlign);
        [id(0x00000005), propput, helpstring("BlockAlign")]
        HRESULT BlockAlign([in] short BlockAlign);
        [id(0x00000006), propget, helpstring("BitsPerSample")]
        HRESULT BitsPerSample([out, retval] short* BitsPerSample);
        [id(0x00000006), propput, helpstring("BitsPerSample")]
        HRESULT BitsPerSample([in] short BitsPerSample);
        [id(0x00000007), propget, helpstring("ExtraData")]
        HRESULT ExtraData([out, retval] VARIANT* ExtraData);
        [id(0x00000007), propput, helpstring("ExtraData")]
        HRESULT ExtraData([in] VARIANT ExtraData);
    };

    [
      odl,
      uuid(6450336F-7D49-4CED-8097-49D6DEE37294),
      helpstring("ISpeechBaseStream Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechBaseStream : IDispatch {
        [id(0x00000001), propget, helpstring("Format")]
        HRESULT Format([out, retval] ISpeechAudioFormat** AudioFormat);
        [id(0x00000001), propputref, helpstring("Format")]
        HRESULT Format([in] ISpeechAudioFormat* AudioFormat);
        [id(0x00000002), helpstring("Read")]
        HRESULT Read(
                        [out] VARIANT* Buffer, 
                        [in] long NumberOfBytes, 
                        [out, retval] long* BytesRead);
        [id(0x00000003), helpstring("Write")]
        HRESULT Write(
                        [in] VARIANT Buffer, 
                        [out, retval] long* BytesWritten);
        [id(0x00000004), helpstring("Seek")]
        HRESULT Seek(
                        [in] VARIANT Position, 
                        [in, optional, defaultvalue(0)] SpeechStreamSeekPositionType Origin, 
                        [out, retval] VARIANT* NewPosition);
    };

    typedef enum {
        SSSPTRelativeToStart = 0,
        SSSPTRelativeToCurrentPosition = 1,
        SSSPTRelativeToEnd = 2
    } SpeechStreamSeekPositionType;

    [
      odl,
      uuid(AF67F125-AB39-4E93-B4A2-CC2E66E182A7),
      helpstring("ISpeechFileStream Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechFileStream : ISpeechBaseStream {
        [id(0x00000064), helpstring("Open")]
        HRESULT Open(
                        [in] BSTR FileName, 
                        [in, optional, defaultvalue(0)] SpeechStreamFileMode FileMode, 
                        [in, optional, defaultvalue(0)] VARIANT_BOOL DoEvents);
        [id(0x00000065), helpstring("Close")]
        HRESULT Close();
    };

    typedef enum {
        SSFMOpenForRead = 0,
        SSFMOpenReadWrite = 1,
        SSFMCreate = 2,
        SSFMCreateForWrite = 3
    } SpeechStreamFileMode;

    [
      odl,
      uuid(EEB14B68-808B-4ABE-A5EA-B51DA7588008),
      helpstring("ISpeechMemoryStream Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechMemoryStream : ISpeechBaseStream {
        [id(0x00000064), helpstring("SetData")]
        HRESULT SetData([in] VARIANT Data);
        [id(0x00000065), helpstring("GetData")]
        HRESULT GetData([out, retval] VARIANT* pData);
    };

    [
      odl,
      uuid(1A9E9F4F-104F-4DB8-A115-EFD7FD0C97AE),
      helpstring("ISpeechCustomStream Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechCustomStream : ISpeechBaseStream {
        [id(0x00000064), propget, helpstring("BaseStream")]
        HRESULT BaseStream([out, retval] IUnknown** ppUnkStream);
        [id(0x00000064), propputref, helpstring("BaseStream")]
        HRESULT BaseStream([in] IUnknown* ppUnkStream);
    };

    [
      odl,
      uuid(CFF8E175-019E-11D3-A08E-00C04F8EF9B5),
      helpstring("ISpeechAudio Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechAudio : ISpeechBaseStream {
        [id(0x000000c8), propget, helpstring("Status")]
        HRESULT Status([out, retval] ISpeechAudioStatus** Status);
        [id(0x000000c9), propget, helpstring("BufferInfo")]
        HRESULT BufferInfo([out, retval] ISpeechAudioBufferInfo** BufferInfo);
        [id(0x000000ca), propget, helpstring("DefaultFormat")]
        HRESULT DefaultFormat([out, retval] ISpeechAudioFormat** StreamFormat);
        [id(0x000000cb), propget, helpstring("Volume")]
        HRESULT Volume([out, retval] long* Volume);
        [id(0x000000cb), propput, helpstring("Volume")]
        HRESULT Volume([in] long Volume);
        [id(0x000000cc), propget, helpstring("BufferNotifySize")]
        HRESULT BufferNotifySize([out, retval] long* BufferNotifySize);
        [id(0x000000cc), propput, helpstring("BufferNotifySize")]
        HRESULT BufferNotifySize([in] long BufferNotifySize);
        [id(0x000000cd), propget, hidden, helpstring("EventHandle")]
        HRESULT EventHandle([out, retval] long* EventHandle);
        [id(0x000000ce), hidden, helpstring("SetState")]
        HRESULT SetState([in] SpeechAudioState State);
    };

    [
      odl,
      uuid(3C76AF6D-1FD7-4831-81D1-3B71D5A13C44),
      helpstring("ISpeechMMSysAudio Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechMMSysAudio : ISpeechAudio {
        [id(0x0000012c), propget, helpstring("DeviceId")]
        HRESULT DeviceId([out, retval] long* DeviceId);
        [id(0x0000012c), propput, helpstring("DeviceId")]
        HRESULT DeviceId([in] long DeviceId);
        [id(0x0000012d), propget, helpstring("LineId")]
        HRESULT LineId([out, retval] long* LineId);
        [id(0x0000012d), propput, helpstring("LineId")]
        HRESULT LineId([in] long LineId);
        [id(0x0000012e), propget, hidden, helpstring("MMHandle")]
        HRESULT MMHandle([out, retval] long* Handle);
    };

    [
      odl,
      uuid(269316D8-57BD-11D2-9EEE-00C04F797396),
      helpstring("ISpeechVoice Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechVoice : IDispatch {
        [id(0x00000001), propget, helpstring("Status")]
        HRESULT Status([out, retval] ISpeechVoiceStatus** Status);
        [id(0x00000002), propget, helpstring("Voice")]
        HRESULT Voice([out, retval] ISpeechObjectToken** Voice);
        [id(0x00000002), propputref, helpstring("Voice")]
        HRESULT Voice([in] ISpeechObjectToken* Voice);
        [id(0x00000003), propget, helpstring("Gets the audio output object")]
        HRESULT AudioOutput([out, retval] ISpeechObjectToken** AudioOutput);
        [id(0x00000003), propputref, helpstring("Gets the audio output object")]
        HRESULT AudioOutput([in] ISpeechObjectToken* AudioOutput);
        [id(0x00000004), propget, helpstring("Gets the audio output stream")]
        HRESULT AudioOutputStream([out, retval] ISpeechBaseStream** AudioOutputStream);
        [id(0x00000004), propputref, helpstring("Gets the audio output stream")]
        HRESULT AudioOutputStream([in] ISpeechBaseStream* AudioOutputStream);
        [id(0x00000005), propget, helpstring("Rate")]
        HRESULT Rate([out, retval] long* Rate);
        [id(0x00000005), propput, helpstring("Rate")]
        HRESULT Rate([in] long Rate);
        [id(0x00000006), propget, helpstring("Volume")]
        HRESULT Volume([out, retval] long* Volume);
        [id(0x00000006), propput, helpstring("Volume")]
        HRESULT Volume([in] long Volume);
        [id(0x00000007), propput, hidden, helpstring("AllowAudioOutputFormatChangesOnNextSet")]
        HRESULT AllowAudioOutputFormatChangesOnNextSet([in] VARIANT_BOOL Allow);
        [id(0x00000007), propget, hidden, helpstring("AllowAudioOutputFormatChangesOnNextSet")]
        HRESULT AllowAudioOutputFormatChangesOnNextSet([out, retval] VARIANT_BOOL* Allow);
        [id(0x00000008), propget, helpstring("EventInterests")]
        HRESULT EventInterests([out, retval] SpeechVoiceEvents* EventInterestFlags);
        [id(0x00000008), propput, helpstring("EventInterests")]
        HRESULT EventInterests([in] SpeechVoiceEvents EventInterestFlags);
        [id(0x00000009), propput, helpstring("Priority")]
        HRESULT Priority([in] SpeechVoicePriority Priority);
        [id(0x00000009), propget, helpstring("Priority")]
        HRESULT Priority([out, retval] SpeechVoicePriority* Priority);
        [id(0x0000000a), propput, helpstring("AlertBoundary")]
        HRESULT AlertBoundary([in] SpeechVoiceEvents Boundary);
        [id(0x0000000a), propget, helpstring("AlertBoundary")]
        HRESULT AlertBoundary([out, retval] SpeechVoiceEvents* Boundary);
        [id(0x0000000b), propput, helpstring("SyncSpeakTimeout")]
        HRESULT SynchronousSpeakTimeout([in] long msTimeout);
        [id(0x0000000b), propget, helpstring("SyncSpeakTimeout")]
        HRESULT SynchronousSpeakTimeout([out, retval] long* msTimeout);
        [id(0x0000000c), helpstring("Speak")]
        HRESULT Speak(
                        [in] BSTR Text, 
                        [in, optional, defaultvalue(0)] SpeechVoiceSpeakFlags Flags, 
                        [out, retval] long* StreamNumber);
        [id(0x0000000d), helpstring("SpeakStream")]
        HRESULT SpeakStream(
                        [in] ISpeechBaseStream* Stream, 
                        [in, optional, defaultvalue(0)] SpeechVoiceSpeakFlags Flags, 
                        [out, retval] long* StreamNumber);
        [id(0x0000000e), helpstring("Pauses the voices rendering.")]
        HRESULT Pause();
        [id(0x0000000f), helpstring("Resumes the voices rendering.")]
        HRESULT Resume();
        [id(0x00000010), helpstring("Skips rendering the specified number of items.")]
        HRESULT Skip(
                        [in] BSTR Type, 
                        [in] long NumItems, 
                        [out, retval] long* NumSkipped);
        [id(0x00000011), helpstring("GetVoices")]
        HRESULT GetVoices(
                        [in, optional, defaultvalue("")] BSTR RequiredAttributes, 
                        [in, optional, defaultvalue("")] BSTR OptionalAttributes, 
                        [out, retval] ISpeechObjectTokens** ObjectTokens);
        [id(0x00000012), helpstring("GetAudioOutputs")]
        HRESULT GetAudioOutputs(
                        [in, optional, defaultvalue("")] BSTR RequiredAttributes, 
                        [in, optional, defaultvalue("")] BSTR OptionalAttributes, 
                        [out, retval] ISpeechObjectTokens** ObjectTokens);
        [id(0x00000013), helpstring("WaitUntilDone")]
        HRESULT WaitUntilDone(
                        [in] long msTimeout, 
                        [out, retval] VARIANT_BOOL* Done);
        [id(0x00000014), hidden, helpstring("SpeakCompleteEvent")]
        HRESULT SpeakCompleteEvent([out, retval] long* Handle);
        [id(0x00000015), helpstring("IsUISupported")]
        HRESULT IsUISupported(
                        [in] BSTR TypeOfUI, 
                        [in, optional, defaultvalue("")] VARIANT* ExtraData, 
                        [out, retval] VARIANT_BOOL* Supported);
        [id(0x00000016), helpstring("DisplayUI")]
        HRESULT DisplayUI(
                        [in] long hWndParent, 
                        [in] BSTR Title, 
                        [in] BSTR TypeOfUI, 
                        [in, optional, defaultvalue("")] VARIANT* ExtraData);
    };

    [
      odl,
      uuid(8BE47B07-57F6-11D2-9EEE-00C04F797396),
      helpstring("ISpeechVoiceStatus Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechVoiceStatus : IDispatch {
        [id(0x00000001), propget, helpstring("CurrentStreamNumber")]
        HRESULT CurrentStreamNumber([out, retval] long* StreamNumber);
        [id(0x00000002), propget, helpstring("LastStreamNumberQueued")]
        HRESULT LastStreamNumberQueued([out, retval] long* StreamNumber);
        [id(0x00000003), propget, helpstring("LastHResult")]
        HRESULT LastHResult([out, retval] long* HResult);
        [id(0x00000004), propget, helpstring("RunningState")]
        HRESULT RunningState([out, retval] SpeechRunState* State);
        [id(0x00000005), propget, helpstring("InputWordPosition")]
        HRESULT InputWordPosition([out, retval] long* Position);
        [id(0x00000006), propget, helpstring("InputWordLength")]
        HRESULT InputWordLength([out, retval] long* Length);
        [id(0x00000007), propget, helpstring("InputSentencePosition")]
        HRESULT InputSentencePosition([out, retval] long* Position);
        [id(0x00000008), propget, helpstring("InputSentenceLength")]
        HRESULT InputSentenceLength([out, retval] long* Length);
        [id(0x00000009), propget, helpstring("LastBookmark")]
        HRESULT LastBookmark([out, retval] BSTR* Bookmark);
        [id(0x0000000a), propget, hidden, helpstring("LastBookmarkId")]
        HRESULT LastBookmarkId([out, retval] long* BookmarkId);
        [id(0x0000000b), propget, helpstring("PhonemeId")]
        HRESULT PhonemeId([out, retval] short* PhoneId);
        [id(0x0000000c), propget, helpstring("VisemeId")]
        HRESULT VisemeId([out, retval] short* VisemeId);
    };

    typedef enum {
        SRSEDone = 1,
        SRSEIsSpeaking = 2
    } SpeechRunState;

    typedef enum {
        SVEStartInputStream = 2,
        SVEEndInputStream = 4,
        SVEVoiceChange = 8,
        SVEBookmark = 16,
        SVEWordBoundary = 32,
        SVEPhoneme = 64,
        SVESentenceBoundary = 128,
        SVEViseme = 256,
        SVEAudioLevel = 512,
        SVEPrivate = 32768,
        SVEAllEvents = 33790
    } SpeechVoiceEvents;

    typedef enum {
        SVPNormal = 0,
        SVPAlert = 1,
        SVPOver = 2
    } SpeechVoicePriority;

    typedef enum {
        SVSFDefault = 0,
        SVSFlagsAsync = 1,
        SVSFPurgeBeforeSpeak = 2,
        SVSFIsFilename = 4,
        SVSFIsXML = 8,
        SVSFIsNotXML = 16,
        SVSFPersistXML = 32,
        SVSFNLPSpeakPunc = 64,
        SVSFParseSapi = 128,
        SVSFParseSsml = 256,
        SVSFParseAutodetect = 0,
        SVSFNLPMask = 64,
        SVSFParseMask = 384,
        SVSFVoiceMask = 511,
        SVSFUnusedFlags = 0xfffffe00
    } SpeechVoiceSpeakFlags;

    [
      uuid(A372ACD1-3BEF-4BBD-8FFB-CB3E2B416AF8)
    ]
    dispinterface _ISpeechVoiceEvents {
        properties:
        methods:
            [id(0x00000001), helpstring("StartStream")]
            void StartStream(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition);
            [id(0x00000002), helpstring("EndStream")]
            void EndStream(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition);
            [id(0x00000003), helpstring("VoiceChange")]
            void VoiceChange(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] ISpeechObjectToken* VoiceObjectToken);
            [id(0x00000004), helpstring("Bookmark")]
            void Bookmark(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] BSTR Bookmark, 
                            [in] long BookmarkId);
            [id(0x00000005), helpstring("Word")]
            void Word(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] long CharacterPosition, 
                            [in] long Length);
            [id(0x00000007), helpstring("Sentence")]
            void Sentence(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] long CharacterPosition, 
                            [in] long Length);
            [id(0x00000006), helpstring("Phoneme")]
            void Phoneme(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] long Duration, 
                            [in] short NextPhoneId, 
                            [in] SpeechVisemeFeature Feature, 
                            [in] short CurrentPhoneId);
            [id(0x00000008), helpstring("Viseme")]
            void Viseme(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] long Duration, 
                            [in] SpeechVisemeType NextVisemeId, 
                            [in] SpeechVisemeFeature Feature, 
                            [in] SpeechVisemeType CurrentVisemeId);
            [id(0x00000009), helpstring("AudioLevel")]
            void AudioLevel(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] long AudioLevel);
            [id(0x0000000a), helpstring("EnginePrivate")]
            void EnginePrivate(
                            [in] long StreamNumber, 
                            [in] long StreamPosition, 
                            [in] VARIANT EngineData);
    };

    typedef enum {
        SVF_None = 0,
        SVF_Stressed = 1,
        SVF_Emphasis = 2
    } SpeechVisemeFeature;

    typedef enum {
        SVP_0 = 0,
        SVP_1 = 1,
        SVP_2 = 2,
        SVP_3 = 3,
        SVP_4 = 4,
        SVP_5 = 5,
        SVP_6 = 6,
        SVP_7 = 7,
        SVP_8 = 8,
        SVP_9 = 9,
        SVP_10 = 10,
        SVP_11 = 11,
        SVP_12 = 12,
        SVP_13 = 13,
        SVP_14 = 14,
        SVP_15 = 15,
        SVP_16 = 16,
        SVP_17 = 17,
        SVP_18 = 18,
        SVP_19 = 19,
        SVP_20 = 20,
        SVP_21 = 21
    } SpeechVisemeType;

    [
      odl,
      uuid(2D5F1C0C-BD75-4B08-9478-3B11FEA2586C),
      helpstring("ISpeechRecognizer Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechRecognizer : IDispatch {
        [id(0x00000001), propputref, helpstring("Recognizer")]
        HRESULT Recognizer([in] ISpeechObjectToken* Recognizer);
        [id(0x00000001), propget, helpstring("Recognizer")]
        HRESULT Recognizer([out, retval] ISpeechObjectToken** Recognizer);
        [id(0x00000002), propput, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet")]
        HRESULT AllowAudioInputFormatChangesOnNextSet([in] VARIANT_BOOL Allow);
        [id(0x00000002), propget, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet")]
        HRESULT AllowAudioInputFormatChangesOnNextSet([out, retval] VARIANT_BOOL* Allow);
        [id(0x00000003), propputref, helpstring("AudioInput")]
        HRESULT AudioInput([in, optional, defaultvalue(0)] ISpeechObjectToken* AudioInput);
        [id(0x00000003), propget, helpstring("AudioInput")]
        HRESULT AudioInput([out, retval] ISpeechObjectToken** AudioInput);
        [id(0x00000004), propputref, helpstring("AudioInputStream")]
        HRESULT AudioInputStream([in, optional, defaultvalue(0)] ISpeechBaseStream* AudioInputStream);
        [id(0x00000004), propget, helpstring("AudioInputStream")]
        HRESULT AudioInputStream([out, retval] ISpeechBaseStream** AudioInputStream);
        [id(0x00000005), propget, helpstring("IsShared")]
        HRESULT IsShared([out, retval] VARIANT_BOOL* Shared);
        [id(0x00000006), propput, helpstring("State")]
        HRESULT State([in] SpeechRecognizerState State);
        [id(0x00000006), propget, helpstring("State")]
        HRESULT State([out, retval] SpeechRecognizerState* State);
        [id(0x00000007), propget, helpstring("Status")]
        HRESULT Status([out, retval] ISpeechRecognizerStatus** Status);
        [id(0x00000008), propputref, helpstring("Profile")]
        HRESULT Profile([in, optional, defaultvalue(0)] ISpeechObjectToken* Profile);
        [id(0x00000008), propget, helpstring("Profile")]
        HRESULT Profile([out, retval] ISpeechObjectToken** Profile);
        [id(0x00000009), helpstring("EmulateRecognition")]
        HRESULT EmulateRecognition(
                        [in] VARIANT TextElements, 
                        [in, optional, defaultvalue("")] VARIANT* ElementDisplayAttributes, 
                        [in, optional, defaultvalue(0)] long LanguageId);
        [id(0x0000000a), helpstring("CreateRecoContext")]
        HRESULT CreateRecoContext([out, retval] ISpeechRecoContext** NewContext);
        [id(0x0000000b), helpstring("GetFormat")]
        HRESULT GetFormat(
                        [in] SpeechFormatType Type, 
                        [out, retval] ISpeechAudioFormat** Format);
        [id(0x0000000c), hidden, helpstring("SetPropertyNumber")]
        HRESULT SetPropertyNumber(
                        [in] BSTR Name, 
                        [in] long Value, 
                        [out, retval] VARIANT_BOOL* Supported);
        [id(0x0000000d), hidden, helpstring("GetPropertyNumber")]
        HRESULT GetPropertyNumber(
                        [in] BSTR Name, 
                        [in, out] long* Value, 
                        [out, retval] VARIANT_BOOL* Supported);
        [id(0x0000000e), hidden, helpstring("SetPropertyString")]
        HRESULT SetPropertyString(
                        [in] BSTR Name, 
                        [in] BSTR Value, 
                        [out, retval] VARIANT_BOOL* Supported);
        [id(0x0000000f), hidden, helpstring("GetPropertyString")]
        HRESULT GetPropertyString(
                        [in] BSTR Name, 
                        [in, out] BSTR* Value, 
                        [out, retval] VARIANT_BOOL* Supported);
        [id(0x00000010), helpstring("IsUISupported")]
        HRESULT IsUISupported(
                        [in] BSTR TypeOfUI, 
                        [in, optional, defaultvalue("")] VARIANT* ExtraData, 
                        [out, retval] VARIANT_BOOL* Supported);
        [id(0x00000011), helpstring("DisplayUI")]
        HRESULT DisplayUI(
                        [in] long hWndParent, 
                        [in] BSTR Title, 
                        [in] BSTR TypeOfUI, 
                        [in, optional, defaultvalue("")] VARIANT* ExtraData);
        [id(0x00000012), helpstring("GetRecognizers")]
        HRESULT GetRecognizers(
                        [in, optional, defaultvalue("")] BSTR RequiredAttributes, 
                        [in, optional, defaultvalue("")] BSTR OptionalAttributes, 
                        [out, retval] ISpeechObjectTokens** ObjectTokens);
        [id(0x00000013), helpstring("GetAudioInputs")]
        HRESULT GetAudioInputs(
                        [in, optional, defaultvalue("")] BSTR RequiredAttributes, 
                        [in, optional, defaultvalue("")] BSTR OptionalAttributes, 
                        [out, retval] ISpeechObjectTokens** ObjectTokens);
        [id(0x00000014), helpstring("GetProfiles")]
        HRESULT GetProfiles(
                        [in, optional, defaultvalue("")] BSTR RequiredAttributes, 
                        [in, optional, defaultvalue("")] BSTR OptionalAttributes, 
                        [out, retval] ISpeechObjectTokens** ObjectTokens);
    };

    typedef enum {
        SRSInactive = 0,
        SRSActive = 1,
        SRSActiveAlways = 2,
        SRSInactiveWithPurge = 3
    } SpeechRecognizerState;

    [
      odl,
      uuid(BFF9E781-53EC-484E-BB8A-0E1B5551E35C),
      helpstring("ISpeechRecognizerStatus Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechRecognizerStatus : IDispatch {
        [id(0x00000001), propget, helpstring("AudioStatus")]
        HRESULT AudioStatus([out, retval] ISpeechAudioStatus** AudioStatus);
        [id(0x00000002), propget, helpstring("CurrentStreamPosition")]
        HRESULT CurrentStreamPosition([out, retval] VARIANT* pCurrentStreamPos);
        [id(0x00000003), propget, helpstring("CurrentStreamNumber")]
        HRESULT CurrentStreamNumber([out, retval] long* StreamNumber);
        [id(0x00000004), propget, helpstring("NumberOfActiveRules")]
        HRESULT NumberOfActiveRules([out, retval] long* NumberOfActiveRules);
        [id(0x00000005), propget, helpstring("ClsidEngine")]
        HRESULT ClsidEngine([out, retval] BSTR* ClsidEngine);
        [id(0x00000006), propget, helpstring("SupportedLanguages")]
        HRESULT SupportedLanguages([out, retval] VARIANT* SupportedLanguages);
    };

    [
      odl,
      uuid(580AA49D-7E1E-4809-B8E2-57DA806104B8),
      helpstring("ISpeechRecoContext Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechRecoContext : IDispatch {
        [id(0x00000001), propget, helpstring("Recognizer")]
        HRESULT Recognizer([out, retval] ISpeechRecognizer** Recognizer);
        [id(0x00000002), propget, helpstring("AudioInInterferenceStatus")]
        HRESULT AudioInputInterferenceStatus([out, retval] SpeechInterference* Interference);
        [id(0x00000003), propget, helpstring("RequestedUIType")]
        HRESULT RequestedUIType([out, retval] BSTR* UIType);
        [id(0x00000004), propputref, helpstring("Voice")]
        HRESULT Voice([in] ISpeechVoice* Voice);
        [id(0x00000004), propget, helpstring("Voice")]
        HRESULT Voice([out, retval] ISpeechVoice** Voice);
        [id(0x00000005), propput, hidden, helpstring("AllowVoiceFormatMatchingOnNextSet")]
        HRESULT AllowVoiceFormatMatchingOnNextSet([in] VARIANT_BOOL pAllow);
        [id(0x00000005), propget, hidden, helpstring("AllowVoiceFormatMatchingOnNextSet")]
        HRESULT AllowVoiceFormatMatchingOnNextSet([out, retval] VARIANT_BOOL* pAllow);
        [id(0x00000006), propput, helpstring("VoicePurgeEvent")]
        HRESULT VoicePurgeEvent([in] SpeechRecoEvents EventInterest);
        [id(0x00000006), propget, helpstring("VoicePurgeEvent")]
        HRESULT VoicePurgeEvent([out, retval] SpeechRecoEvents* EventInterest);
        [id(0x00000007), propput, helpstring("EventInterests")]
        HRESULT EventInterests([in] SpeechRecoEvents EventInterest);
        [id(0x00000007), propget, helpstring("EventInterests")]
        HRESULT EventInterests([out, retval] SpeechRecoEvents* EventInterest);
        [id(0x00000008), propput, helpstring("CmdMaxAlternates")]
        HRESULT CmdMaxAlternates([in] long MaxAlternates);
        [id(0x00000008), propget, helpstring("CmdMaxAlternates")]
        HRESULT CmdMaxAlternates([out, retval] long* MaxAlternates);
        [id(0x00000009), propput, helpstring("State")]
        HRESULT State([in] SpeechRecoContextState State);
        [id(0x00000009), propget, helpstring("State")]
        HRESULT State([out, retval] SpeechRecoContextState* State);
        [id(0x0000000a), propput, helpstring("RetainedAudio")]
        HRESULT RetainedAudio([in] SpeechRetainedAudioOptions Option);
        [id(0x0000000a), propget, helpstring("RetainedAudio")]
        HRESULT RetainedAudio([out, retval] SpeechRetainedAudioOptions* Option);
        [id(0x0000000b), propputref, helpstring("RetainedAudioFormat")]
        HRESULT RetainedAudioFormat([in] ISpeechAudioFormat* Format);
        [id(0x0000000b), propget, helpstring("RetainedAudioFormat")]
        HRESULT RetainedAudioFormat([out, retval] ISpeechAudioFormat** Format);
        [id(0x0000000c), helpstring("Pause")]
        HRESULT Pause();
        [id(0x0000000d), helpstring("Resume")]
        HRESULT Resume();
        [id(0x0000000e), helpstring("CreateGrammar")]
        HRESULT CreateGrammar(
                        [in, optional, defaultvalue(0)] VARIANT GrammarId, 
                        [out, retval] ISpeechRecoGrammar** Grammar);
        [id(0x0000000f), helpstring("CreateResultFromMemory")]
        HRESULT CreateResultFromMemory(
                        [in] VARIANT* ResultBlock, 
                        [out, retval] ISpeechRecoResult** Result);
        [id(0x00000010), helpstring("Bookmark")]
        HRESULT Bookmark(
                        [in] SpeechBookmarkOptions Options, 
                        [in] VARIANT StreamPos, 
                        [in] VARIANT BookmarkId);
        [id(0x00000011), helpstring("SetAdaptationData")]
        HRESULT SetAdaptationData([in] BSTR AdaptationString);
    };

    typedef enum {
        SINone = 0,
        SINoise = 1,
        SINoSignal = 2,
        SITooLoud = 3,
        SITooQuiet = 4,
        SITooFast = 5,
        SITooSlow = 6
    } SpeechInterference;

    typedef enum {
        SREStreamEnd = 1,
        SRESoundStart = 2,
        SRESoundEnd = 4,
        SREPhraseStart = 8,
        SRERecognition = 16,
        SREHypothesis = 32,
        SREBookmark = 64,
        SREPropertyNumChange = 128,
        SREPropertyStringChange = 256,
        SREFalseRecognition = 512,
        SREInterference = 1024,
        SRERequestUI = 2048,
        SREStateChange = 4096,
        SREAdaptation = 8192,
        SREStreamStart = 16384,
        SRERecoOtherContext = 32768,
        SREAudioLevel = 0x00010000,
        SREPrivate = 0x00040000,
        SREAllEvents = 0x0005ffff
    } SpeechRecoEvents;

    typedef enum {
        SRCS_Disabled = 0,
        SRCS_Enabled = 1
    } SpeechRecoContextState;

    typedef enum {
        SRAONone = 0,
        SRAORetainAudio = 1
    } SpeechRetainedAudioOptions;

    [
      odl,
      uuid(B6D6F79F-2158-4E50-B5BC-9A9CCD852A09),
      helpstring("ISpeechRecoGrammar Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechRecoGrammar : IDispatch {
        [id(0x00000001), propget, helpstring("Id")]
        HRESULT Id([out, retval] VARIANT* Id);
        [id(0x00000002), propget, helpstring("RecoContext")]
        HRESULT RecoContext([out, retval] ISpeechRecoContext** RecoContext);
        [id(0x00000003), propput, helpstring("State")]
        HRESULT State([in] SpeechGrammarState State);
        [id(0x00000003), propget, helpstring("State")]
        HRESULT State([out, retval] SpeechGrammarState* State);
        [id(0x00000004), propget, helpstring("Rules")]
        HRESULT Rules([out, retval] ISpeechGrammarRules** Rules);
        [id(0x00000005), helpstring("Reset")]
        HRESULT Reset([in, optional, defaultvalue(0)] long NewLanguage);
        [id(0x00000007), helpstring("CmdLoadFromFile")]
        HRESULT CmdLoadFromFile(
                        [in] BSTR FileName, 
                        [in, optional, defaultvalue(0)] SpeechLoadOption LoadOption);
        [id(0x00000008), helpstring("CmdLoadFromObject")]
        HRESULT CmdLoadFromObject(
                        [in] BSTR ClassId, 
                        [in] BSTR GrammarName, 
                        [in, optional, defaultvalue(0)] SpeechLoadOption LoadOption);
        [id(0x00000009), helpstring("CmdLoadFromResource")]
        HRESULT CmdLoadFromResource(
                        [in] long hModule, 
                        [in] VARIANT ResourceName, 
                        [in] VARIANT ResourceType, 
                        [in] long LanguageId, 
                        [in, optional, defaultvalue(0)] SpeechLoadOption LoadOption);
        [id(0x0000000a), helpstring("CmdLoadFromMemory")]
        HRESULT CmdLoadFromMemory(
                        [in] VARIANT GrammarData, 
                        [in, optional, defaultvalue(0)] SpeechLoadOption LoadOption);
        [id(0x0000000b), helpstring("CmdLoadFromProprietaryGrammar")]
        HRESULT CmdLoadFromProprietaryGrammar(
                        [in] BSTR ProprietaryGuid, 
                        [in] BSTR ProprietaryString, 
                        [in] VARIANT ProprietaryData, 
                        [in, optional, defaultvalue(0)] SpeechLoadOption LoadOption);
        [id(0x0000000c), helpstring("CmdSetRuleState")]
        HRESULT CmdSetRuleState(
                        [in] BSTR Name, 
                        [in] SpeechRuleState State);
        [id(0x0000000d), helpstring("CmdSetRuleIdState")]
        HRESULT CmdSetRuleIdState(
                        [in] long RuleId, 
                        [in] SpeechRuleState State);
        [id(0x0000000e), helpstring("DictationLoad")]
        HRESULT DictationLoad(
                        [in, optional, defaultvalue("")] BSTR TopicName, 
                        [in, optional, defaultvalue(0)] SpeechLoadOption LoadOption);
        [id(0x0000000f), helpstring("DictationUnload")]
        HRESULT DictationUnload();
        [id(0x00000010), helpstring("DictationSetState")]
        HRESULT DictationSetState([in] SpeechRuleState State);
        [id(0x00000011), helpstring("SetWordSequenceData")]
        HRESULT SetWordSequenceData(
                        [in] BSTR Text, 
                        [in] long TextLength, 
                        [in] ISpeechTextSelectionInformation* Info);
        [id(0x00000012), helpstring("SetTextSelection")]
        HRESULT SetTextSelection([in] ISpeechTextSelectionInformation* Info);
        [id(0x00000013), helpstring("IsPronounceable")]
        HRESULT IsPronounceable(
                        [in] BSTR Word, 
                        [out, retval] SpeechWordPronounceable* WordPronounceable);
    };

    typedef enum {
        SGSEnabled = 1,
        SGSDisabled = 0,
        SGSExclusive = 3
    } SpeechGrammarState;

    [
      odl,
      uuid(6FFA3B44-FC2D-40D1-8AFC-32911C7F1AD1),
      helpstring("ISpeechGrammarRules Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechGrammarRules : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(0x00000006), helpstring("FindRule")]
        HRESULT FindRule(
                        [in] VARIANT RuleNameOrId, 
                        [out, retval] ISpeechGrammarRule** Rule);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechGrammarRule** Rule);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the alternates")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
        [id(0x00000002), propget, helpstring("Dynamic")]
        HRESULT Dynamic([out, retval] VARIANT_BOOL* Dynamic);
        [id(0x00000003), helpstring("Add")]
        HRESULT Add(
                        [in] BSTR RuleName, 
                        [in] SpeechRuleAttributes Attributes, 
                        [in, optional, defaultvalue(0)] long RuleId, 
                        [out, retval] ISpeechGrammarRule** Rule);
        [id(0x00000004), helpstring("Commit")]
        HRESULT Commit();
        [id(0x00000005), helpstring("CommitAndSave")]
        HRESULT CommitAndSave(
                        [out] BSTR* ErrorText, 
                        [out, retval] VARIANT* SaveStream);
    };

    [
      odl,
      uuid(AFE719CF-5DD1-44F2-999C-7A399F1CFCCC),
      helpstring("ISpeechGrammarRule Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechGrammarRule : IDispatch {
        [id(0x00000001), propget, helpstring("RuleAttributes")]
        HRESULT Attributes([out, retval] SpeechRuleAttributes* Attributes);
        [id(0x00000002), propget, helpstring("InitialState")]
        HRESULT InitialState([out, retval] ISpeechGrammarRuleState** State);
        [id(0x00000003), propget, helpstring("Name")]
        HRESULT Name([out, retval] BSTR* Name);
        [id(0x00000004), propget, helpstring("Id")]
        HRESULT Id([out, retval] long* Id);
        [id(0x00000005), helpstring("Clear")]
        HRESULT Clear();
        [id(0x00000006), helpstring("AddResource")]
        HRESULT AddResource(
                        [in] BSTR ResourceName, 
                        [in] BSTR ResourceValue);
        [id(0x00000007), helpstring("AddState")]
        HRESULT AddState([out, retval] ISpeechGrammarRuleState** State);
    };

    typedef enum {
        SRATopLevel = 1,
        SRADefaultToActive = 2,
        SRAExport = 4,
        SRAImport = 8,
        SRAInterpreter = 16,
        SRADynamic = 32,
        SRARoot = 64
    } SpeechRuleAttributes;

    [
      odl,
      uuid(D4286F2C-EE67-45AE-B928-28D695362EDA),
      helpstring("ISpeechGrammarRuleState Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechGrammarRuleState : IDispatch {
        [id(0x00000001), propget, helpstring("Rule")]
        HRESULT Rule([out, retval] ISpeechGrammarRule** Rule);
        [id(0x00000002), propget, helpstring("Transitions")]
        HRESULT Transitions([out, retval] ISpeechGrammarRuleStateTransitions** Transitions);
        [id(0x00000003), helpstring("AddWordTransition")]
        HRESULT AddWordTransition(
                        [in] ISpeechGrammarRuleState* DestState, 
                        [in] BSTR Words, 
                        [in, optional, defaultvalue(" ")] BSTR Separators, 
                        [in, optional, defaultvalue(1)] SpeechGrammarWordType Type, 
                        [in, optional, defaultvalue("")] BSTR PropertyName, 
                        [in, optional, defaultvalue(0)] long PropertyId, 
                        [in, optional, defaultvalue("")] VARIANT* PropertyValue, 
                        [in, optional, defaultvalue(1)] single Weight);
        [id(0x00000004), helpstring("AddRuleTransition")]
        HRESULT AddRuleTransition(
                        [in] ISpeechGrammarRuleState* DestinationState, 
                        [in] ISpeechGrammarRule* Rule, 
                        [in, optional, defaultvalue("")] BSTR PropertyName, 
                        [in, optional, defaultvalue(0)] long PropertyId, 
                        [in, optional, defaultvalue("")] VARIANT* PropertyValue, 
                        [in, optional, defaultvalue(1)] single Weight);
        [id(0x00000005), helpstring("AddSpecialTransition")]
        HRESULT AddSpecialTransition(
                        [in] ISpeechGrammarRuleState* DestinationState, 
                        [in] SpeechSpecialTransitionType Type, 
                        [in, optional, defaultvalue("")] BSTR PropertyName, 
                        [in, optional, defaultvalue(0)] long PropertyId, 
                        [in, optional, defaultvalue("")] VARIANT* PropertyValue, 
                        [in, optional, defaultvalue(1)] single Weight);
    };

    [
      odl,
      uuid(EABCE657-75BC-44A2-AA7F-C56476742963),
      helpstring("ISpeechGrammarRuleStateTransitions Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechGrammarRuleStateTransitions : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechGrammarRuleStateTransition** Transition);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the transitions")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
    };

    [
      odl,
      uuid(CAFD1DB1-41D1-4A06-9863-E2E81DA17A9A),
      helpstring("ISpeechGrammarRuleStateTransition Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechGrammarRuleStateTransition : IDispatch {
        [id(0x00000001), propget, helpstring("Type")]
        HRESULT Type([out, retval] SpeechGrammarRuleStateTransitionType* Type);
        [id(0x00000002), propget, helpstring("Text")]
        HRESULT Text([out, retval] BSTR* Text);
        [id(0x00000003), propget, helpstring("Rule")]
        HRESULT Rule([out, retval] ISpeechGrammarRule** Rule);
        [id(0x00000004), propget, helpstring("Weight")]
        HRESULT Weight([out, retval] VARIANT* Weight);
        [id(0x00000005), propget, helpstring("PropertyName")]
        HRESULT PropertyName([out, retval] BSTR* PropertyName);
        [id(0x00000006), propget, helpstring("PropertyId")]
        HRESULT PropertyId([out, retval] long* PropertyId);
        [id(0x00000007), propget, helpstring("PropertyValue")]
        HRESULT PropertyValue([out, retval] VARIANT* PropertyValue);
        [id(0x00000008), propget, helpstring("NextState")]
        HRESULT NextState([out, retval] ISpeechGrammarRuleState** NextState);
    };

    typedef enum {
        SGRSTTEpsilon = 0,
        SGRSTTWord = 1,
        SGRSTTRule = 2,
        SGRSTTDictation = 3,
        SGRSTTWildcard = 4,
        SGRSTTTextBuffer = 5
    } SpeechGrammarRuleStateTransitionType;

    typedef enum {
        SGDisplay = 0,
        SGLexical = 1,
        SGPronounciation = 2,
        SGLexicalNoSpecialChars = 3
    } SpeechGrammarWordType;

    typedef enum {
        SSTTWildcard = 1,
        SSTTDictation = 2,
        SSTTTextBuffer = 3
    } SpeechSpecialTransitionType;

    typedef enum {
        SLOStatic = 0,
        SLODynamic = 1
    } SpeechLoadOption;

    typedef enum {
        SGDSInactive = 0,
        SGDSActive = 1,
        SGDSActiveWithAutoPause = 3,
        SGDSActiveUserDelimited = 4
    } SpeechRuleState;

    [
      odl,
      uuid(3B9C7E7A-6EEE-4DED-9092-11657279ADBE),
      helpstring("ISpeechTextSelectionInformation Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechTextSelectionInformation : IDispatch {
        [id(0x00000001), propput, helpstring("ActiveOffset")]
        HRESULT ActiveOffset([in] long ActiveOffset);
        [id(0x00000001), propget, helpstring("ActiveOffset")]
        HRESULT ActiveOffset([out, retval] long* ActiveOffset);
        [id(0x00000002), propput, helpstring("ActiveLength")]
        HRESULT ActiveLength([in] long ActiveLength);
        [id(0x00000002), propget, helpstring("ActiveLength")]
        HRESULT ActiveLength([out, retval] long* ActiveLength);
        [id(0x00000003), propput, helpstring("SelectionOffset")]
        HRESULT SelectionOffset([in] long SelectionOffset);
        [id(0x00000003), propget, helpstring("SelectionOffset")]
        HRESULT SelectionOffset([out, retval] long* SelectionOffset);
        [id(0x00000004), propput, helpstring("SelectionLength")]
        HRESULT SelectionLength([in] long SelectionLength);
        [id(0x00000004), propget, helpstring("SelectionLength")]
        HRESULT SelectionLength([out, retval] long* SelectionLength);
    };

    typedef enum {
        SWPUnknownWordUnpronounceable = 0,
        SWPUnknownWordPronounceable = 1,
        SWPKnownWordPronounceable = 2
    } SpeechWordPronounceable;

    [
      odl,
      uuid(ED2879CF-CED9-4EE6-A534-DE0191D5468D),
      helpstring("ISpeechRecoResult Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechRecoResult : IDispatch {
        [id(0x00000001), propget, helpstring("RecoContext")]
        HRESULT RecoContext([out, retval] ISpeechRecoContext** RecoContext);
        [id(0x00000002), propget, helpstring("Times")]
        HRESULT Times([out, retval] ISpeechRecoResultTimes** Times);
        [id(0x00000003), propputref, helpstring("AudioFormat")]
        HRESULT AudioFormat([in] ISpeechAudioFormat* Format);
        [id(0x00000003), propget, helpstring("AudioFormat")]
        HRESULT AudioFormat([out, retval] ISpeechAudioFormat** Format);
        [id(0x00000004), propget, helpstring("PhraseInfo")]
        HRESULT PhraseInfo([out, retval] ISpeechPhraseInfo** PhraseInfo);
        [id(0x00000005), helpstring("Alternates")]
        HRESULT Alternates(
                        [in] long RequestCount, 
                        [in, optional, defaultvalue(0)] long StartElement, 
                        [in, optional, defaultvalue(-1)] long Elements, 
                        [out, retval] ISpeechPhraseAlternates** Alternates);
        [id(0x00000006), helpstring("Audio")]
        HRESULT Audio(
                        [in, optional, defaultvalue(0)] long StartElement, 
                        [in, optional, defaultvalue(-1)] long Elements, 
                        [out, retval] ISpeechMemoryStream** Stream);
        [id(0x00000007), helpstring("SpeakAudio")]
        HRESULT SpeakAudio(
                        [in, optional, defaultvalue(0)] long StartElement, 
                        [in, optional, defaultvalue(-1)] long Elements, 
                        [in, optional, defaultvalue(0)] SpeechVoiceSpeakFlags Flags, 
                        [out, retval] long* StreamNumber);
        [id(0x00000008), helpstring("SaveToMemory")]
        HRESULT SaveToMemory([out, retval] VARIANT* ResultBlock);
        [id(0x00000009), helpstring("DiscardResultInfo")]
        HRESULT DiscardResultInfo([in] SpeechDiscardType ValueTypes);
    };

    [
      odl,
      uuid(62B3B8FB-F6E7-41BE-BDCB-056B1C29EFC0),
      helpstring("ISpeechRecoResultTimes Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechRecoResultTimes : IDispatch {
        [id(0x00000001), propget, helpstring("StreamTime")]
        HRESULT StreamTime([out, retval] VARIANT* Time);
        [id(0x00000002), propget, helpstring("Length")]
        HRESULT Length([out, retval] VARIANT* Length);
        [id(0x00000003), propget, helpstring("TickCount")]
        HRESULT TickCount([out, retval] long* TickCount);
        [id(0x00000004), propget, helpstring("Start")]
        HRESULT OffsetFromStart([out, retval] VARIANT* OffsetFromStart);
    };

    [
      odl,
      uuid(961559CF-4E67-4662-8BF0-D93F1FCD61B3),
      helpstring("ISpeechPhraseInfo Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseInfo : IDispatch {
        [id(0x00000001), propget, helpstring("LanguageId")]
        HRESULT LanguageId([out, retval] long* LanguageId);
        [id(0x00000002), propget, helpstring("GrammarId")]
        HRESULT GrammarId([out, retval] VARIANT* GrammarId);
        [id(0x00000003), propget, helpstring("StartTime")]
        HRESULT StartTime([out, retval] VARIANT* StartTime);
        [id(0x00000004), propget, helpstring("AudioStreamPosition")]
        HRESULT AudioStreamPosition([out, retval] VARIANT* AudioStreamPosition);
        [id(0x00000005), propget, helpstring("AudioSizeBytes")]
        HRESULT AudioSizeBytes([out, retval] long* pAudioSizeBytes);
        [id(0x00000006), propget, helpstring("RetainedSizeBytes")]
        HRESULT RetainedSizeBytes([out, retval] long* RetainedSizeBytes);
        [id(0x00000007), propget, helpstring("AudioSizeTime")]
        HRESULT AudioSizeTime([out, retval] long* AudioSizeTime);
        [id(0x00000008), propget, helpstring("Rule")]
        HRESULT Rule([out, retval] ISpeechPhraseRule** Rule);
        [id(0x00000009), propget, helpstring("Properties")]
        HRESULT Properties([out, retval] ISpeechPhraseProperties** Properties);
        [id(0x0000000a), propget, helpstring("Elements")]
        HRESULT Elements([out, retval] ISpeechPhraseElements** Elements);
        [id(0x0000000b), propget, helpstring("Replacements")]
        HRESULT Replacements([out, retval] ISpeechPhraseReplacements** Replacements);
        [id(0x0000000c), propget, helpstring("EngineId")]
        HRESULT EngineId([out, retval] BSTR* EngineIdGuid);
        [id(0x0000000d), propget, helpstring("EnginePrivateData")]
        HRESULT EnginePrivateData([out, retval] VARIANT* PrivateData);
        [id(0x0000000e), helpstring("SaveToMemory")]
        HRESULT SaveToMemory([out, retval] VARIANT* PhraseBlock);
        [id(0x0000000f), helpstring("GetText")]
        HRESULT GetText(
                        [in, optional, defaultvalue(0)] long StartElement, 
                        [in, optional, defaultvalue(-1)] long Elements, 
                        [in, optional, defaultvalue(-1)] VARIANT_BOOL UseReplacements, 
                        [out, retval] BSTR* Text);
        [id(0x00000010), helpstring("DisplayAttributes")]
        HRESULT GetDisplayAttributes(
                        [in, optional, defaultvalue(0)] long StartElement, 
                        [in, optional, defaultvalue(-1)] long Elements, 
                        [in, optional, defaultvalue(-1)] VARIANT_BOOL UseReplacements, 
                        [out, retval] SpeechDisplayAttributes* DisplayAttributes);
    };

    [
      odl,
      uuid(A7BFE112-A4A0-48D9-B602-C313843F6964),
      helpstring("ISpeechPhraseRule Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseRule : IDispatch {
        [id(0x00000001), propget, helpstring("Name")]
        HRESULT Name([out, retval] BSTR* Name);
        [id(0x00000002), propget, helpstring("Id")]
        HRESULT Id([out, retval] long* Id);
        [id(0x00000003), propget, helpstring("FirstElement")]
        HRESULT FirstElement([out, retval] long* FirstElement);
        [id(0x00000004), propget, helpstring("NumElements")]
        HRESULT NumberOfElements([out, retval] long* NumberOfElements);
        [id(0x00000005), propget, helpstring("Parent")]
        HRESULT Parent([out, retval] ISpeechPhraseRule** Parent);
        [id(0x00000006), propget, helpstring("Children")]
        HRESULT Children([out, retval] ISpeechPhraseRules** Children);
        [id(0x00000007), propget, helpstring("Confidence")]
        HRESULT Confidence([out, retval] SpeechEngineConfidence* ActualConfidence);
        [id(0x00000008), propget, helpstring("EngineConfidence")]
        HRESULT EngineConfidence([out, retval] single* EngineConfidence);
    };

    [
      odl,
      uuid(9047D593-01DD-4B72-81A3-E4A0CA69F407),
      helpstring("ISpeechPhraseRules Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseRules : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechPhraseRule** Rule);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the Rules")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
    };

    typedef enum {
        SECLowConfidence = 0xffffffff,
        SECNormalConfidence = 0,
        SECHighConfidence = 1
    } SpeechEngineConfidence;

    [
      odl,
      uuid(08166B47-102E-4B23-A599-BDB98DBFD1F4),
      helpstring("ISpeechPhraseProperties Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseProperties : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechPhraseProperty** Property);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the alternates")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
    };

    [
      odl,
      uuid(CE563D48-961E-4732-A2E1-378A42B430BE),
      helpstring("ISpeechPhraseProperty Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseProperty : IDispatch {
        [id(0x00000001), propget, helpstring("Name")]
        HRESULT Name([out, retval] BSTR* Name);
        [id(0x00000002), propget, helpstring("Id")]
        HRESULT Id([out, retval] long* Id);
        [id(0x00000003), propget, helpstring("Value")]
        HRESULT Value([out, retval] VARIANT* Value);
        [id(0x00000004), propget, helpstring("FirstElement")]
        HRESULT FirstElement([out, retval] long* FirstElement);
        [id(0x00000005), propget, helpstring("NumberOfElements")]
        HRESULT NumberOfElements([out, retval] long* NumberOfElements);
        [id(0x00000006), propget, helpstring("EngineConfidence")]
        HRESULT EngineConfidence([out, retval] single* Confidence);
        [id(0x00000007), propget, helpstring("Confidence")]
        HRESULT Confidence([out, retval] SpeechEngineConfidence* Confidence);
        [id(0x00000008), propget, helpstring("Parent")]
        HRESULT Parent([out, retval] ISpeechPhraseProperty** ParentProperty);
        [id(0x00000009), propget, helpstring("Children")]
        HRESULT Children([out, retval] ISpeechPhraseProperties** Children);
    };

    [
      odl,
      uuid(0626B328-3478-467D-A0B3-D0853B93DDA3),
      helpstring("ISpeechPhraseElements Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseElements : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechPhraseElement** Element);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the tokens")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
    };

    [
      odl,
      uuid(E6176F96-E373-4801-B223-3B62C068C0B4),
      helpstring("ISpeechPhraseElement Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseElement : IDispatch {
        [id(0x00000001), propget, helpstring("AudioTimeOffset")]
        HRESULT AudioTimeOffset([out, retval] long* AudioTimeOffset);
        [id(0x00000002), propget, helpstring("AudioSizeTime")]
        HRESULT AudioSizeTime([out, retval] long* AudioSizeTime);
        [id(0x00000003), propget, helpstring("AudioStreamOffset")]
        HRESULT AudioStreamOffset([out, retval] long* AudioStreamOffset);
        [id(0x00000004), propget, helpstring("AudioSizeBytes")]
        HRESULT AudioSizeBytes([out, retval] long* AudioSizeBytes);
        [id(0x00000005), propget, helpstring("RetainedStreamOffset")]
        HRESULT RetainedStreamOffset([out, retval] long* RetainedStreamOffset);
        [id(0x00000006), propget, helpstring("RetainedSizeBytes")]
        HRESULT RetainedSizeBytes([out, retval] long* RetainedSizeBytes);
        [id(0x00000007), propget, helpstring("DisplayText")]
        HRESULT DisplayText([out, retval] BSTR* DisplayText);
        [id(0x00000008), propget, helpstring("LexicalForm")]
        HRESULT LexicalForm([out, retval] BSTR* LexicalForm);
        [id(0x00000009), propget, helpstring("Pronunciation")]
        HRESULT Pronunciation([out, retval] VARIANT* Pronunciation);
        [id(0x0000000a), propget, helpstring("DisplayAttributes")]
        HRESULT DisplayAttributes([out, retval] SpeechDisplayAttributes* DisplayAttributes);
        [id(0x0000000b), propget, helpstring("RequiredConfidence")]
        HRESULT RequiredConfidence([out, retval] SpeechEngineConfidence* RequiredConfidence);
        [id(0x0000000c), propget, helpstring("ActualConfidence")]
        HRESULT ActualConfidence([out, retval] SpeechEngineConfidence* ActualConfidence);
        [id(0x0000000d), propget, helpstring("EngineConfidence")]
        HRESULT EngineConfidence([out, retval] single* EngineConfidence);
    };

    typedef enum {
        SDA_No_Trailing_Space = 0,
        SDA_One_Trailing_Space = 2,
        SDA_Two_Trailing_Spaces = 4,
        SDA_Consume_Leading_Spaces = 8
    } SpeechDisplayAttributes;

    [
      odl,
      uuid(38BC662F-2257-4525-959E-2069D2596C05),
      helpstring("ISpeechPhraseReplacements Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseReplacements : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechPhraseReplacement** Reps);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the tokens")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
    };

    [
      odl,
      uuid(2890A410-53A7-4FB5-94EC-06D4998E3D02),
      helpstring("ISpeechPhraseReplacement Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseReplacement : IDispatch {
        [id(0x00000001), propget, helpstring("DisplayAttributes")]
        HRESULT DisplayAttributes([out, retval] SpeechDisplayAttributes* DisplayAttributes);
        [id(0x00000002), propget, helpstring("Text")]
        HRESULT Text([out, retval] BSTR* Text);
        [id(0x00000003), propget, helpstring("FirstElement")]
        HRESULT FirstElement([out, retval] long* FirstElement);
        [id(0x00000004), propget, helpstring("NumElements")]
        HRESULT NumberOfElements([out, retval] long* NumberOfElements);
    };

    [
      odl,
      uuid(B238B6D5-F276-4C3D-A6C1-2974801C3CC2),
      helpstring("ISpeechPhraseAlternates Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseAlternates : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechPhraseAlternate** PhraseAlternate);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the alternates")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
    };

    [
      odl,
      uuid(27864A2A-2B9F-4CB8-92D3-0D2722FD1E73),
      helpstring("ISpeechPhraseAlternate Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseAlternate : IDispatch {
        [id(0x00000001), propget, helpstring("RecoResult")]
        HRESULT RecoResult([out, retval] ISpeechRecoResult** RecoResult);
        [id(0x00000002), propget, helpstring("StartElementInResult")]
        HRESULT StartElementInResult([out, retval] long* StartElement);
        [id(0x00000003), propget, helpstring("NumberOfElementsInResult")]
        HRESULT NumberOfElementsInResult([out, retval] long* NumberOfElements);
        [id(0x00000004), propget, helpstring("Phrase")]
        HRESULT PhraseInfo([out, retval] ISpeechPhraseInfo** PhraseInfo);
        [id(0x00000005), helpstring("Commit")]
        HRESULT Commit();
    };

    typedef enum {
        SDTProperty = 1,
        SDTReplacement = 2,
        SDTRule = 4,
        SDTDisplayText = 8,
        SDTLexicalForm = 16,
        SDTPronunciation = 32,
        SDTAudio = 64,
        SDTAlternates = 128,
        SDTAll = 255
    } SpeechDiscardType;

    typedef enum {
        SBONone = 0,
        SBOPause = 1
    } SpeechBookmarkOptions;

    typedef enum {
        SFTInput = 0,
        SFTSREngine = 1
    } SpeechFormatType;

    [
      uuid(7B8FCB42-0E9D-4F00-A048-7B04D6179D3D)
    ]
    dispinterface _ISpeechRecoContextEvents {
        properties:
        methods:
            [id(0x00000001), helpstring("StartStream")]
            void StartStream(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition);
            [id(0x00000002), helpstring("EndStream")]
            void EndStream(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] VARIANT_BOOL StreamReleased);
            [id(0x00000003), helpstring("Bookmark")]
            void Bookmark(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] VARIANT BookmarkId, 
                            [in] SpeechBookmarkOptions Options);
            [id(0x00000004), helpstring("SoundStart")]
            void SoundStart(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition);
            [id(0x00000005), helpstring("SoundEnd")]
            void SoundEnd(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition);
            [id(0x00000006), helpstring("PhraseStart")]
            void PhraseStart(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition);
            [id(0x00000007), helpstring("Recognition")]
            void Recognition(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] SpeechRecognitionType RecognitionType, 
                            [in] ISpeechRecoResult* Result);
            [id(0x00000008), helpstring("Hypothesis")]
            void Hypothesis(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] ISpeechRecoResult* Result);
            [id(0x00000009), helpstring("PropertyNumberChange")]
            void PropertyNumberChange(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] BSTR PropertyName, 
                            [in] long NewNumberValue);
            [id(0x0000000a), helpstring("PropertyStringChange")]
            void PropertyStringChange(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] BSTR PropertyName, 
                            [in] BSTR NewStringValue);
            [id(0x0000000b), helpstring("FalseRecognition")]
            void FalseRecognition(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] ISpeechRecoResult* Result);
            [id(0x0000000c), helpstring("Interference")]
            void Interference(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] SpeechInterference Interference);
            [id(0x0000000d), helpstring("RequestUI")]
            void RequestUI(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] BSTR UIType);
            [id(0x0000000e), helpstring("RecognizerStateChange")]
            void RecognizerStateChange(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] SpeechRecognizerState NewState);
            [id(0x0000000f), helpstring("Adaptation")]
            void Adaptation(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition);
            [id(0x00000010), helpstring("RecognitionForOtherContext")]
            void RecognitionForOtherContext(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition);
            [id(0x00000011), helpstring("AudioLevel")]
            void AudioLevel(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] long AudioLevel);
            [id(0x00000012), helpstring("EnginePrivate")]
            void EnginePrivate(
                            [in] long StreamNumber, 
                            [in] VARIANT StreamPosition, 
                            [in] VARIANT EngineData);
    };

    typedef enum {
        SRTStandard = 0,
        SRTAutopause = 1,
        SRTEmulated = 2,
        SRTSMLTimeout = 4,
        SRTExtendableParse = 8,
        SRTReSent = 16
    } SpeechRecognitionType;

    [
      odl,
      uuid(8E0A246D-D3C8-45DE-8657-04290C458C3C),
      helpstring("ISpeechRecoResult2 Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechRecoResult2 : ISpeechRecoResult {
        [id(0x0000000c), helpstring("DiscardResultInfo")]
        HRESULT SetTextFeedback(
                        [in] BSTR Feedback, 
                        [in] VARIANT_BOOL WasSuccessful);
    };

    [
      odl,
      uuid(3DA7627A-C7AE-4B23-8708-638C50362C25),
      helpstring("ISpeechLexicon Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechLexicon : IDispatch {
        [id(0x00000001), propget, hidden, helpstring("GenerationId")]
        HRESULT GenerationId([out, retval] long* GenerationId);
        [id(0x00000002), helpstring("GetWords")]
        HRESULT GetWords(
                        [in, optional, defaultvalue(3)] SpeechLexiconType Flags, 
                        [out, optional, defaultvalue(0)] long* GenerationId, 
                        [out, retval] ISpeechLexiconWords** Words);
        [id(0x00000003), helpstring("AddPronunciation")]
        HRESULT AddPronunciation(
                        [in] BSTR bstrWord, 
                        [in] long LangId, 
                        [in, optional, defaultvalue(0)] SpeechPartOfSpeech PartOfSpeech, 
                        [in, optional, defaultvalue("")] BSTR bstrPronunciation);
        [id(0x00000004), hidden, helpstring("AddPronunciationByPhoneIds")]
        HRESULT AddPronunciationByPhoneIds(
                        [in] BSTR bstrWord, 
                        [in] long LangId, 
                        [in, optional, defaultvalue(0)] SpeechPartOfSpeech PartOfSpeech, 
                        [in, optional, defaultvalue("")] VARIANT* PhoneIds);
        [id(0x00000005), helpstring("RemovePronunciation")]
        HRESULT RemovePronunciation(
                        [in] BSTR bstrWord, 
                        [in] long LangId, 
                        [in, optional, defaultvalue(0)] SpeechPartOfSpeech PartOfSpeech, 
                        [in, optional, defaultvalue("")] BSTR bstrPronunciation);
        [id(0x00000006), hidden, helpstring("RemovePronunciationByPhoneIds")]
        HRESULT RemovePronunciationByPhoneIds(
                        [in] BSTR bstrWord, 
                        [in] long LangId, 
                        [in, optional, defaultvalue(0)] SpeechPartOfSpeech PartOfSpeech, 
                        [in, optional, defaultvalue("")] VARIANT* PhoneIds);
        [id(0x00000007), helpstring("GetPronunciations")]
        HRESULT GetPronunciations(
                        [in] BSTR bstrWord, 
                        [in, optional, defaultvalue(0)] long LangId, 
                        [in, optional, defaultvalue(3)] SpeechLexiconType TypeFlags, 
                        [out, retval] ISpeechLexiconPronunciations** ppPronunciations);
        [id(0x00000008), hidden, helpstring("GetGenerationChange")]
        HRESULT GetGenerationChange(
                        [in, out] long* GenerationId, 
                        [out, retval] ISpeechLexiconWords** ppWords);
    };

    typedef enum {
        SLTUser = 1,
        SLTApp = 2
    } SpeechLexiconType;

    [
      odl,
      uuid(8D199862-415E-47D5-AC4F-FAA608B424E6),
      helpstring("ISpeechLexiconWords Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechLexiconWords : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechLexiconWord** Word);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the tokens")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
    };

    [
      odl,
      uuid(4E5B933C-C9BE-48ED-8842-1EE51BB1D4FF),
      helpstring("ISpeechLexiconWord Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechLexiconWord : IDispatch {
        [id(0x00000001), propget]
        HRESULT LangId([out, retval] long* LangId);
        [id(0x00000002), propget]
        HRESULT Type([out, retval] SpeechWordType* WordType);
        [id(0x00000003), propget]
        HRESULT Word([out, retval] BSTR* Word);
        [id(0x00000004), propget]
        HRESULT Pronunciations([out, retval] ISpeechLexiconPronunciations** Pronunciations);
    };

    typedef enum {
        SWTAdded = 1,
        SWTDeleted = 2
    } SpeechWordType;

    [
      odl,
      uuid(72829128-5682-4704-A0D4-3E2BB6F2EAD3),
      helpstring("ISpeechLexiconPronunciations Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechLexiconPronunciations : IDispatch {
        [id(0x00000001), propget, helpstring("Count")]
        HRESULT Count([out, retval] long* Count);
        [id(00000000), helpstring("Item")]
        HRESULT Item(
                        [in] long Index, 
                        [out, retval] ISpeechLexiconPronunciation** Pronunciation);
        [id(0xfffffffc), propget, restricted, helpstring("Enumerates the tokens")]
        HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT);
    };

    [
      odl,
      uuid(95252C5D-9E43-4F4A-9899-48EE73352F9F),
      helpstring("ISpeechLexiconPronunciation Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechLexiconPronunciation : IDispatch {
        [id(0x00000001), propget, helpstring("Type")]
        HRESULT Type([out, retval] SpeechLexiconType* LexiconType);
        [id(0x00000002), propget, helpstring("LangId")]
        HRESULT LangId([out, retval] long* LangId);
        [id(0x00000003), propget, helpstring("PartOfSpeech")]
        HRESULT PartOfSpeech([out, retval] SpeechPartOfSpeech* PartOfSpeech);
        [id(0x00000004), propget, helpstring("PhoneIds")]
        HRESULT PhoneIds([out, retval] VARIANT* PhoneIds);
        [id(0x00000005), propget, helpstring("Symbolic")]
        HRESULT Symbolic([out, retval] BSTR* Symbolic);
    };

    typedef enum {
        SPSNotOverriden = 0xffffffff,
        SPSUnknown = 0,
        SPSNoun = 4096,
        SPSVerb = 8192,
        SPSModifier = 12288,
        SPSFunction = 16384,
        SPSInterjection = 20480,
        SPSLMA = 28672,
        SPSSuppressWord = 61440
    } SpeechPartOfSpeech;

    // NOTE: This module has no entry points. There is no way to
    //       extract the dllname of a module with no entry points!
    // 
    [
      dllname("<no entry points>"),
      uuid(E58442E4-0C80-402C-9559-867337A39765)
    ]
    module SpeechStringConstants {
        const BSTR SpeechRegistryUserRoot = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech";
        const BSTR SpeechRegistryLocalMachineRoot = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech";
        const BSTR SpeechCategoryAudioOut = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput";
        const BSTR SpeechCategoryAudioIn = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput";
        const BSTR SpeechCategoryVoices = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices";
        const BSTR SpeechCategoryRecognizers = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Recognizers";
        const BSTR SpeechCategoryAppLexicons = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AppLexicons";
        const BSTR SpeechCategoryPhoneConverters = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\PhoneConverters";
        const BSTR SpeechCategoryRecoProfiles = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\RecoProfiles";
        const BSTR SpeechTokenIdUserLexicon = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserLexicon";
        const BSTR SpeechTokenValueCLSID = "CLSID";
        const BSTR SpeechTokenKeyFiles = "Files";
        const BSTR SpeechTokenKeyUI = "UI";
        const BSTR SpeechTokenKeyAttributes = "Attributes";
        const BSTR SpeechVoiceCategoryTTSRate = "DefaultTTSRate";
        const BSTR SpeechPropertyResourceUsage = "ResourceUsage";
        const BSTR SpeechPropertyHighConfidenceThreshold = "HighConfidenceThreshold";
        const BSTR SpeechPropertyNormalConfidenceThreshold = "NormalConfidenceThreshold";
        const BSTR SpeechPropertyLowConfidenceThreshold = "LowConfidenceThreshold";
        const BSTR SpeechPropertyResponseSpeed = "ResponseSpeed";
        const BSTR SpeechPropertyComplexResponseSpeed = "ComplexResponseSpeed";
        const BSTR SpeechPropertyAdaptationOn = "AdaptationOn";
        const BSTR SpeechDictationTopicSpelling = "Spelling";
        const BSTR SpeechGrammarTagWildcard = "...";
        const BSTR SpeechGrammarTagDictation = "*";
        const BSTR SpeechGrammarTagUnlimitedDictation = "*+";
        const BSTR SpeechEngineProperties = "EngineProperties";
        const BSTR SpeechAddRemoveWord = "AddRemoveWord";
        const BSTR SpeechUserTraining = "UserTraining";
        const BSTR SpeechMicTraining = "MicTraining";
        const BSTR SpeechRecoProfileProperties = "RecoProfileProperties";
        const BSTR SpeechAudioProperties = "AudioProperties";
        const BSTR SpeechAudioVolume = "AudioVolume";
        const BSTR SpeechVoiceSkipTypeSentence = "Sentence";
        const BSTR SpeechAudioFormatGUIDWave = "{C31ADBAE-527F-4ff5-A230-F62BB61FF70C}";
        const BSTR SpeechAudioFormatGUIDText = "{7CEEF9F9-3D13-11d2-9EE7-00C04F797396}";
    };

    // NOTE: This module has no entry points. There is no way to
    //       extract the dllname of a module with no entry points!
    // 
    [
      dllname("<no entry points>"),
      uuid(F3E092B2-6BDC-410F-BCB2-4C5ED4424180)
    ]
    module SpeechConstants {
        const single Speech_Default_Weight = 1;
        const long Speech_Max_Word_Length = 128;
        const long Speech_Max_Pron_Length = 384;
        const long Speech_StreamPos_Asap = 0;
        const long Speech_StreamPos_RealTime = 0xffffffff;
        const long SpeechAllElements = 0xffffffff;
    };

    typedef enum {
        DISPID_SDKSetBinaryValue = 1,
        DISPID_SDKGetBinaryValue = 2,
        DISPID_SDKSetStringValue = 3,
        DISPID_SDKGetStringValue = 4,
        DISPID_SDKSetLongValue = 5,
        DISPID_SDKGetlongValue = 6,
        DISPID_SDKOpenKey = 7,
        DISPID_SDKCreateKey = 8,
        DISPID_SDKDeleteKey = 9,
        DISPID_SDKDeleteValue = 10,
        DISPID_SDKEnumKeys = 11,
        DISPID_SDKEnumValues = 12
    } DISPID_SpeechDataKey;

    typedef enum {
        DISPID_SOTId = 1,
        DISPID_SOTDataKey = 2,
        DISPID_SOTCategory = 3,
        DISPID_SOTGetDescription = 4,
        DISPID_SOTSetId = 5,
        DISPID_SOTGetAttribute = 6,
        DISPID_SOTCreateInstance = 7,
        DISPID_SOTRemove = 8,
        DISPID_SOTGetStorageFileName = 9,
        DISPID_SOTRemoveStorageFileName = 10,
        DISPID_SOTIsUISupported = 11,
        DISPID_SOTDisplayUI = 12,
        DISPID_SOTMatchesAttributes = 13
    } DISPID_SpeechObjectToken;

    typedef enum {
        DISPID_SOTsCount = 1,
        DISPID_SOTsItem = 0,
        DISPID_SOTs_NewEnum = 0xfffffffc
    } DISPID_SpeechObjectTokens;

    typedef enum {
        DISPID_SOTCId = 1,
        DISPID_SOTCDefault = 2,
        DISPID_SOTCSetId = 3,
        DISPID_SOTCGetDataKey = 4,
        DISPID_SOTCEnumerateTokens = 5
    } DISPID_SpeechObjectTokenCategory;

    typedef enum {
        DISPID_SAFType = 1,
        DISPID_SAFGuid = 2,
        DISPID_SAFGetWaveFormatEx = 3,
        DISPID_SAFSetWaveFormatEx = 4
    } DISPID_SpeechAudioFormat;

    typedef enum {
        DISPID_SBSFormat = 1,
        DISPID_SBSRead = 2,
        DISPID_SBSWrite = 3,
        DISPID_SBSSeek = 4
    } DISPID_SpeechBaseStream;

    typedef enum {
        DISPID_SAStatus = 200,
        DISPID_SABufferInfo = 201,
        DISPID_SADefaultFormat = 202,
        DISPID_SAVolume = 203,
        DISPID_SABufferNotifySize = 204,
        DISPID_SAEventHandle = 205,
        DISPID_SASetState = 206
    } DISPID_SpeechAudio;

    typedef enum {
        DISPID_SMSADeviceId = 300,
        DISPID_SMSALineId = 301,
        DISPID_SMSAMMHandle = 302
    } DISPID_SpeechMMSysAudio;

    typedef enum {
        DISPID_SFSOpen = 100,
        DISPID_SFSClose = 101
    } DISPID_SpeechFileStream;

    typedef enum {
        DISPID_SCSBaseStream = 100
    } DISPID_SpeechCustomStream;

    typedef enum {
        DISPID_SMSSetData = 100,
        DISPID_SMSGetData = 101
    } DISPID_SpeechMemoryStream;

    typedef enum {
        DISPID_SASFreeBufferSpace = 1,
        DISPID_SASNonBlockingIO = 2,
        DISPID_SASState = 3,
        DISPID_SASCurrentSeekPosition = 4,
        DISPID_SASCurrentDevicePosition = 5
    } DISPID_SpeechAudioStatus;

    typedef enum {
        DISPID_SABIMinNotification = 1,
        DISPID_SABIBufferSize = 2,
        DISPID_SABIEventBias = 3
    } DISPID_SpeechAudioBufferInfo;

    typedef enum {
        DISPID_SWFEFormatTag = 1,
        DISPID_SWFEChannels = 2,
        DISPID_SWFESamplesPerSec = 3,
        DISPID_SWFEAvgBytesPerSec = 4,
        DISPID_SWFEBlockAlign = 5,
        DISPID_SWFEBitsPerSample = 6,
        DISPID_SWFEExtraData = 7
    } DISPID_SpeechWaveFormatEx;

    typedef enum {
        DISPID_SVStatus = 1,
        DISPID_SVVoice = 2,
        DISPID_SVAudioOutput = 3,
        DISPID_SVAudioOutputStream = 4,
        DISPID_SVRate = 5,
        DISPID_SVVolume = 6,
        DISPID_SVAllowAudioOuputFormatChangesOnNextSet = 7,
        DISPID_SVEventInterests = 8,
        DISPID_SVPriority = 9,
        DISPID_SVAlertBoundary = 10,
        DISPID_SVSyncronousSpeakTimeout = 11,
        DISPID_SVSpeak = 12,
        DISPID_SVSpeakStream = 13,
        DISPID_SVPause = 14,
        DISPID_SVResume = 15,
        DISPID_SVSkip = 16,
        DISPID_SVGetVoices = 17,
        DISPID_SVGetAudioOutputs = 18,
        DISPID_SVWaitUntilDone = 19,
        DISPID_SVSpeakCompleteEvent = 20,
        DISPID_SVIsUISupported = 21,
        DISPID_SVDisplayUI = 22
    } DISPID_SpeechVoice;

    typedef enum {
        DISPID_SVSCurrentStreamNumber = 1,
        DISPID_SVSLastStreamNumberQueued = 2,
        DISPID_SVSLastResult = 3,
        DISPID_SVSRunningState = 4,
        DISPID_SVSInputWordPosition = 5,
        DISPID_SVSInputWordLength = 6,
        DISPID_SVSInputSentencePosition = 7,
        DISPID_SVSInputSentenceLength = 8,
        DISPID_SVSLastBookmark = 9,
        DISPID_SVSLastBookmarkId = 10,
        DISPID_SVSPhonemeId = 11,
        DISPID_SVSVisemeId = 12
    } DISPID_SpeechVoiceStatus;

    typedef enum {
        DISPID_SVEStreamStart = 1,
        DISPID_SVEStreamEnd = 2,
        DISPID_SVEVoiceChange = 3,
        DISPID_SVEBookmark = 4,
        DISPID_SVEWord = 5,
        DISPID_SVEPhoneme = 6,
        DISPID_SVESentenceBoundary = 7,
        DISPID_SVEViseme = 8,
        DISPID_SVEAudioLevel = 9,
        DISPID_SVEEnginePrivate = 10
    } DISPID_SpeechVoiceEvent;

    typedef enum {
        DISPID_SRRecognizer = 1,
        DISPID_SRAllowAudioInputFormatChangesOnNextSet = 2,
        DISPID_SRAudioInput = 3,
        DISPID_SRAudioInputStream = 4,
        DISPID_SRIsShared = 5,
        DISPID_SRState = 6,
        DISPID_SRStatus = 7,
        DISPID_SRProfile = 8,
        DISPID_SREmulateRecognition = 9,
        DISPID_SRCreateRecoContext = 10,
        DISPID_SRGetFormat = 11,
        DISPID_SRSetPropertyNumber = 12,
        DISPID_SRGetPropertyNumber = 13,
        DISPID_SRSetPropertyString = 14,
        DISPID_SRGetPropertyString = 15,
        DISPID_SRIsUISupported = 16,
        DISPID_SRDisplayUI = 17,
        DISPID_SRGetRecognizers = 18,
        DISPID_SVGetAudioInputs = 19,
        DISPID_SVGetProfiles = 20
    } DISPID_SpeechRecognizer;

    typedef enum {
        SECFIgnoreCase = 1,
        SECFIgnoreKanaType = 0x00010000,
        SECFIgnoreWidth = 0x00020000,
        SECFNoSpecialChars = 0x20000000,
        SECFEmulateResult = 0x40000000,
        SECFDefault = 0x00030001
    } SpeechEmulationCompareFlags;

    typedef enum {
        DISPID_SRSAudioStatus = 1,
        DISPID_SRSCurrentStreamPosition = 2,
        DISPID_SRSCurrentStreamNumber = 3,
        DISPID_SRSNumberOfActiveRules = 4,
        DISPID_SRSClsidEngine = 5,
        DISPID_SRSSupportedLanguages = 6
    } DISPID_SpeechRecognizerStatus;

    typedef enum {
        DISPID_SRCRecognizer = 1,
        DISPID_SRCAudioInInterferenceStatus = 2,
        DISPID_SRCRequestedUIType = 3,
        DISPID_SRCVoice = 4,
        DISPID_SRAllowVoiceFormatMatchingOnNextSet = 5,
        DISPID_SRCVoicePurgeEvent = 6,
        DISPID_SRCEventInterests = 7,
        DISPID_SRCCmdMaxAlternates = 8,
        DISPID_SRCState = 9,
        DISPID_SRCRetainedAudio = 10,
        DISPID_SRCRetainedAudioFormat = 11,
        DISPID_SRCPause = 12,
        DISPID_SRCResume = 13,
        DISPID_SRCCreateGrammar = 14,
        DISPID_SRCCreateResultFromMemory = 15,
        DISPID_SRCBookmark = 16,
        DISPID_SRCSetAdaptationData = 17
    } DISPID_SpeechRecoContext;

    typedef enum {
        DISPID_SRGId = 1,
        DISPID_SRGRecoContext = 2,
        DISPID_SRGState = 3,
        DISPID_SRGRules = 4,
        DISPID_SRGReset = 5,
        DISPID_SRGCommit = 6,
        DISPID_SRGCmdLoadFromFile = 7,
        DISPID_SRGCmdLoadFromObject = 8,
        DISPID_SRGCmdLoadFromResource = 9,
        DISPID_SRGCmdLoadFromMemory = 10,
        DISPID_SRGCmdLoadFromProprietaryGrammar = 11,
        DISPID_SRGCmdSetRuleState = 12,
        DISPID_SRGCmdSetRuleIdState = 13,
        DISPID_SRGDictationLoad = 14,
        DISPID_SRGDictationUnload = 15,
        DISPID_SRGDictationSetState = 16,
        DISPID_SRGSetWordSequenceData = 17,
        DISPID_SRGSetTextSelection = 18,
        DISPID_SRGIsPronounceable = 19
    } DISPIDSPRG;

    typedef enum {
        DISPID_SRCEStartStream = 1,
        DISPID_SRCEEndStream = 2,
        DISPID_SRCEBookmark = 3,
        DISPID_SRCESoundStart = 4,
        DISPID_SRCESoundEnd = 5,
        DISPID_SRCEPhraseStart = 6,
        DISPID_SRCERecognition = 7,
        DISPID_SRCEHypothesis = 8,
        DISPID_SRCEPropertyNumberChange = 9,
        DISPID_SRCEPropertyStringChange = 10,
        DISPID_SRCEFalseRecognition = 11,
        DISPID_SRCEInterference = 12,
        DISPID_SRCERequestUI = 13,
        DISPID_SRCERecognizerStateChange = 14,
        DISPID_SRCEAdaptation = 15,
        DISPID_SRCERecognitionForOtherContext = 16,
        DISPID_SRCEAudioLevel = 17,
        DISPID_SRCEEnginePrivate = 18
    } DISPID_SpeechRecoContextEvents;

    typedef enum {
        DISPID_SGRAttributes = 1,
        DISPID_SGRInitialState = 2,
        DISPID_SGRName = 3,
        DISPID_SGRId = 4,
        DISPID_SGRClear = 5,
        DISPID_SGRAddResource = 6,
        DISPID_SGRAddState = 7
    } DISPID_SpeechGrammarRule;

    typedef enum {
        DISPID_SGRsCount = 1,
        DISPID_SGRsDynamic = 2,
        DISPID_SGRsAdd = 3,
        DISPID_SGRsCommit = 4,
        DISPID_SGRsCommitAndSave = 5,
        DISPID_SGRsFindRule = 6,
        DISPID_SGRsItem = 0,
        DISPID_SGRs_NewEnum = 0xfffffffc
    } DISPID_SpeechGrammarRules;

    typedef enum {
        DISPID_SGRSRule = 1,
        DISPID_SGRSTransitions = 2,
        DISPID_SGRSAddWordTransition = 3,
        DISPID_SGRSAddRuleTransition = 4,
        DISPID_SGRSAddSpecialTransition = 5
    } DISPID_SpeechGrammarRuleState;

    typedef enum {
        DISPID_SGRSTsCount = 1,
        DISPID_SGRSTsItem = 0,
        DISPID_SGRSTs_NewEnum = 0xfffffffc
    } DISPID_SpeechGrammarRuleStateTransitions;

    typedef enum {
        DISPID_SGRSTType = 1,
        DISPID_SGRSTText = 2,
        DISPID_SGRSTRule = 3,
        DISPID_SGRSTWeight = 4,
        DISPID_SGRSTPropertyName = 5,
        DISPID_SGRSTPropertyId = 6,
        DISPID_SGRSTPropertyValue = 7,
        DISPID_SGRSTNextState = 8
    } DISPID_SpeechGrammarRuleStateTransition;

    typedef enum {
        DISPIDSPTSI_ActiveOffset = 1,
        DISPIDSPTSI_ActiveLength = 2,
        DISPIDSPTSI_SelectionOffset = 3,
        DISPIDSPTSI_SelectionLength = 4
    } DISPIDSPTSI;

    typedef enum {
        DISPID_SRRRecoContext = 1,
        DISPID_SRRTimes = 2,
        DISPID_SRRAudioFormat = 3,
        DISPID_SRRPhraseInfo = 4,
        DISPID_SRRAlternates = 5,
        DISPID_SRRAudio = 6,
        DISPID_SRRSpeakAudio = 7,
        DISPID_SRRSaveToMemory = 8,
        DISPID_SRRDiscardResultInfo = 9
    } DISPID_SpeechRecoResult;

    typedef enum {
        DISPID_SRRGetXMLResult = 10,
        DISPID_SRRGetXMLErrorInfo = 11
    } DISPID_SpeechXMLRecoResult;

    [
      odl,
      uuid(AAEC54AF-8F85-4924-944D-B79D39D72E19),
      helpstring("ISpeechXMLRecoResult Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechXMLRecoResult : ISpeechRecoResult {
        [id(0x0000000a), helpstring("GetXMLResult")]
        HRESULT GetXMLResult(
                        [in] SPXMLRESULTOPTIONS Options, 
                        [out, retval] BSTR* pResult);
        [id(0x0000000b), helpstring("GetXMLErrorInfo")]
        HRESULT GetXMLErrorInfo(
                        [out] long* LineNumber, 
                        [out] BSTR* ScriptLine, 
                        [out] BSTR* Source, 
                        [out] BSTR* Description, 
                        [out] long* ResultCode, 
                        [out, retval] VARIANT_BOOL* IsError);
    };

    typedef enum {
        SPXRO_SML = 0,
        SPXRO_Alternates_SML = 1
    } SPXMLRESULTOPTIONS;

    typedef enum {
        DISPID_SRRSetTextFeedback = 12
    } DISPID_SpeechRecoResult2;

    [
      odl,
      uuid(6D60EB64-ACED-40A6-BBF3-4E557F71DEE2),
      helpstring("ISpeechRecoResultDispatch Interface"),
      hidden,
      dual,
      oleautomation
    ]
    interface ISpeechRecoResultDispatch : IDispatch {
        [id(0x00000001), propget, helpstring("RecoContext")]
        HRESULT RecoContext([out, retval] ISpeechRecoContext** RecoContext);
        [id(0x00000002), propget, helpstring("Times")]
        HRESULT Times([out, retval] ISpeechRecoResultTimes** Times);
        [id(0x00000003), propputref, helpstring("AudioFormat")]
        HRESULT AudioFormat([in] ISpeechAudioFormat* Format);
        [id(0x00000003), propget, helpstring("AudioFormat")]
        HRESULT AudioFormat([out, retval] ISpeechAudioFormat** Format);
        [id(0x00000004), propget, helpstring("PhraseInfo")]
        HRESULT PhraseInfo([out, retval] ISpeechPhraseInfo** PhraseInfo);
        [id(0x00000005), helpstring("Alternates")]
        HRESULT Alternates(
                        [in] long RequestCount, 
                        [in, optional, defaultvalue(0)] long StartElement, 
                        [in, optional, defaultvalue(-1)] long Elements, 
                        [out, retval] ISpeechPhraseAlternates** Alternates);
        [id(0x00000006), helpstring("Audio")]
        HRESULT Audio(
                        [in, optional, defaultvalue(0)] long StartElement, 
                        [in, optional, defaultvalue(-1)] long Elements, 
                        [out, retval] ISpeechMemoryStream** Stream);
        [id(0x00000007), helpstring("SpeakAudio")]
        HRESULT SpeakAudio(
                        [in, optional, defaultvalue(0)] long StartElement, 
                        [in, optional, defaultvalue(-1)] long Elements, 
                        [in, optional, defaultvalue(0)] SpeechVoiceSpeakFlags Flags, 
                        [out, retval] long* StreamNumber);
        [id(0x00000008), helpstring("SaveToMemory")]
        HRESULT SaveToMemory([out, retval] VARIANT* ResultBlock);
        [id(0x00000009), helpstring("DiscardResultInfo")]
        HRESULT DiscardResultInfo([in] SpeechDiscardType ValueTypes);
        [id(0x0000000a), helpstring("GetXMLResult")]
        HRESULT GetXMLResult(
                        [in] SPXMLRESULTOPTIONS Options, 
                        [out, retval] BSTR* pResult);
        [id(0x0000000b), helpstring("GetXMLErrorInfo")]
        HRESULT GetXMLErrorInfo(
                        [out] long* LineNumber, 
                        [out] BSTR* ScriptLine, 
                        [out] BSTR* Source, 
                        [out] BSTR* Description, 
                        [out] HRESULT* ResultCode, 
                        [out, retval] VARIANT_BOOL* IsError);
        [id(0x0000000c), helpstring("SetTextFeedback")]
        HRESULT SetTextFeedback(
                        [in] BSTR Feedback, 
                        [in] VARIANT_BOOL WasSuccessful);
    };

    typedef enum {
        DISPID_SPPBRestorePhraseFromMemory = 1
    } DISPID_SpeechPhraseBuilder;

    [
      odl,
      uuid(3B151836-DF3A-4E0A-846C-D2ADC9334333),
      helpstring("ISpeechPhraseInfoBuilder Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhraseInfoBuilder : IDispatch {
        [id(0x00000001), helpstring("RestorePhraseFromMemory")]
        HRESULT RestorePhraseFromMemory(
                        [in] VARIANT* PhraseInMemory, 
                        [out, retval] ISpeechPhraseInfo** PhraseInfo);
    };

    typedef enum {
        DISPID_SRRTStreamTime = 1,
        DISPID_SRRTLength = 2,
        DISPID_SRRTTickCount = 3,
        DISPID_SRRTOffsetFromStart = 4
    } DISPID_SpeechRecoResultTimes;

    typedef enum {
        DISPID_SPARecoResult = 1,
        DISPID_SPAStartElementInResult = 2,
        DISPID_SPANumberOfElementsInResult = 3,
        DISPID_SPAPhraseInfo = 4,
        DISPID_SPACommit = 5
    } DISPID_SpeechPhraseAlternate;

    typedef enum {
        DISPID_SPAsCount = 1,
        DISPID_SPAsItem = 0,
        DISPID_SPAs_NewEnum = 0xfffffffc
    } DISPID_SpeechPhraseAlternates;

    typedef enum {
        DISPID_SPILanguageId = 1,
        DISPID_SPIGrammarId = 2,
        DISPID_SPIStartTime = 3,
        DISPID_SPIAudioStreamPosition = 4,
        DISPID_SPIAudioSizeBytes = 5,
        DISPID_SPIRetainedSizeBytes = 6,
        DISPID_SPIAudioSizeTime = 7,
        DISPID_SPIRule = 8,
        DISPID_SPIProperties = 9,
        DISPID_SPIElements = 10,
        DISPID_SPIReplacements = 11,
        DISPID_SPIEngineId = 12,
        DISPID_SPIEnginePrivateData = 13,
        DISPID_SPISaveToMemory = 14,
        DISPID_SPIGetText = 15,
        DISPID_SPIGetDisplayAttributes = 16
    } DISPID_SpeechPhraseInfo;

    typedef enum {
        DISPID_SPEAudioTimeOffset = 1,
        DISPID_SPEAudioSizeTime = 2,
        DISPID_SPEAudioStreamOffset = 3,
        DISPID_SPEAudioSizeBytes = 4,
        DISPID_SPERetainedStreamOffset = 5,
        DISPID_SPERetainedSizeBytes = 6,
        DISPID_SPEDisplayText = 7,
        DISPID_SPELexicalForm = 8,
        DISPID_SPEPronunciation = 9,
        DISPID_SPEDisplayAttributes = 10,
        DISPID_SPERequiredConfidence = 11,
        DISPID_SPEActualConfidence = 12,
        DISPID_SPEEngineConfidence = 13
    } DISPID_SpeechPhraseElement;

    typedef enum {
        DISPID_SPEsCount = 1,
        DISPID_SPEsItem = 0,
        DISPID_SPEs_NewEnum = 0xfffffffc
    } DISPID_SpeechPhraseElements;

    typedef enum {
        DISPID_SPRDisplayAttributes = 1,
        DISPID_SPRText = 2,
        DISPID_SPRFirstElement = 3,
        DISPID_SPRNumberOfElements = 4
    } DISPID_SpeechPhraseReplacement;

    typedef enum {
        DISPID_SPRsCount = 1,
        DISPID_SPRsItem = 0,
        DISPID_SPRs_NewEnum = 0xfffffffc
    } DISPID_SpeechPhraseReplacements;

    typedef enum {
        DISPID_SPPName = 1,
        DISPID_SPPId = 2,
        DISPID_SPPValue = 3,
        DISPID_SPPFirstElement = 4,
        DISPID_SPPNumberOfElements = 5,
        DISPID_SPPEngineConfidence = 6,
        DISPID_SPPConfidence = 7,
        DISPID_SPPParent = 8,
        DISPID_SPPChildren = 9
    } DISPID_SpeechPhraseProperty;

    typedef enum {
        DISPID_SPPsCount = 1,
        DISPID_SPPsItem = 0,
        DISPID_SPPs_NewEnum = 0xfffffffc
    } DISPID_SpeechPhraseProperties;

    typedef enum {
        DISPID_SPRuleName = 1,
        DISPID_SPRuleId = 2,
        DISPID_SPRuleFirstElement = 3,
        DISPID_SPRuleNumberOfElements = 4,
        DISPID_SPRuleParent = 5,
        DISPID_SPRuleChildren = 6,
        DISPID_SPRuleConfidence = 7,
        DISPID_SPRuleEngineConfidence = 8
    } DISPID_SpeechPhraseRule;

    typedef enum {
        DISPID_SPRulesCount = 1,
        DISPID_SPRulesItem = 0,
        DISPID_SPRules_NewEnum = 0xfffffffc
    } DISPID_SpeechPhraseRules;

    typedef enum {
        DISPID_SLGenerationId = 1,
        DISPID_SLGetWords = 2,
        DISPID_SLAddPronunciation = 3,
        DISPID_SLAddPronunciationByPhoneIds = 4,
        DISPID_SLRemovePronunciation = 5,
        DISPID_SLRemovePronunciationByPhoneIds = 6,
        DISPID_SLGetPronunciations = 7,
        DISPID_SLGetGenerationChange = 8
    } DISPID_SpeechLexicon;

    typedef enum {
        DISPID_SLWsCount = 1,
        DISPID_SLWsItem = 0,
        DISPID_SLWs_NewEnum = 0xfffffffc
    } DISPID_SpeechLexiconWords;

    typedef enum {
        DISPID_SLWLangId = 1,
        DISPID_SLWType = 2,
        DISPID_SLWWord = 3,
        DISPID_SLWPronunciations = 4
    } DISPID_SpeechLexiconWord;

    typedef enum {
        DISPID_SLPsCount = 1,
        DISPID_SLPsItem = 0,
        DISPID_SLPs_NewEnum = 0xfffffffc
    } DISPID_SpeechLexiconProns;

    typedef enum {
        DISPID_SLPType = 1,
        DISPID_SLPLangId = 2,
        DISPID_SLPPartOfSpeech = 3,
        DISPID_SLPPhoneIds = 4,
        DISPID_SLPSymbolic = 5
    } DISPID_SpeechLexiconPronunciation;

    typedef enum {
        DISPID_SPCLangId = 1,
        DISPID_SPCPhoneToId = 2,
        DISPID_SPCIdToPhone = 3
    } DISPID_SpeechPhoneConverter;

    [
      odl,
      uuid(C3E4F353-433F-43D6-89A1-6A62A7054C3D),
      helpstring("ISpeechPhoneConverter Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechPhoneConverter : IDispatch {
        [id(0x00000001), propget, helpstring("LanguageId")]
        HRESULT LanguageId([out, retval] long* LanguageId);
        [id(0x00000001), propput, helpstring("LanguageId")]
        HRESULT LanguageId([in] long LanguageId);
        [id(0x00000002), helpstring("PhoneToId")]
        HRESULT PhoneToId(
                        [in] BSTR Phonemes, 
                        [out, retval] VARIANT* IdArray);
        [id(0x00000003), helpstring("IdToPhone")]
        HRESULT IdToPhone(
                        [in] VARIANT IdArray, 
                        [out, retval] BSTR* Phonemes);
    };

    [
      uuid(E2AE5372-5D40-11D2-960E-00C04F8EE628),
      helpstring("SpNotify"),
      hidden,
      restricted
    ]
    coclass SpNotifyTranslator {
        [default] interface ISpNotifyTranslator;
    };

    [
      odl,
      uuid(ACA16614-5D3D-11D2-960E-00C04F8EE628),
      helpstring("ISpNotifyTranslator Interface"),
      restricted
    ]
    interface ISpNotifyTranslator : ISpNotifySink {
        HRESULT _stdcall InitWindowMessage(
                        [in] wireHWND hWnd, 
                        [in] unsigned int Msg, 
                        [in] UINT_PTR wParam, 
                        [in] LONG_PTR lParam);
        HRESULT _stdcall InitCallback(
                        [in] void** pfnCallback, 
                        [in] UINT_PTR wParam, 
                        [in] LONG_PTR lParam);
        HRESULT _stdcall InitSpNotifyCallback(
                        [in] void** pSpCallback, 
                        [in] UINT_PTR wParam, 
                        [in] LONG_PTR lParam);
        HRESULT _stdcall InitWin32Event(
                        [in] void* hEvent, 
                        [in] long fCloseHandleOnRelease);
        HRESULT _stdcall Wait([in] unsigned long dwMilliseconds);
        void* _stdcall GetEventHandle();
    };

    [
      odl,
      uuid(259684DC-37C3-11D2-9603-00C04F8EE628),
      helpstring("ISpNotifySink Interface"),
      restricted
    ]
    interface ISpNotifySink : IUnknown {
        HRESULT _stdcall Notify();
    };

    typedef [public]
    _RemotableHandle* wireHWND;

    typedef struct tag_RemotableHandle {
                
long fContext;
                
__MIDL_IWinTypes_0009 u;
    } _RemotableHandle;

    typedef union tag__MIDL_IWinTypes_0009 {
                
long hInproc;
                
long hRemote;
    } __MIDL_IWinTypes_0009;

    typedef [public    ,
      custom(F914481D-9C62-4B43-9340-E9B2E6252E5F, 1)    
]
    uint64 UINT_PTR;

    typedef [public    ,
      custom(F914481D-9C62-4B43-9340-E9B2E6252E5F, 1)    
]
    int64 LONG_PTR;

    [
      uuid(A910187F-0C7A-45AC-92CC-59EDAFB77B53),
      helpstring("SpObjectTokenCategory Class")
    ]
    coclass SpObjectTokenCategory {
        [default] interface ISpeechObjectTokenCategory;
        interface ISpObjectTokenCategory;
    };

    [
      odl,
      uuid(2D3D3845-39AF-4850-BBF9-40B49780011D),
      helpstring("ISpObjectTokenCategory"),
      restricted
    ]
    interface ISpObjectTokenCategory : ISpDataKey {
        HRESULT _stdcall SetId(
                        [in] LPWSTR pszCategoryId, 
                        [in] long fCreateIfNotExist);
        HRESULT _stdcall GetId([out] LPWSTR* ppszCoMemCategoryId);
        HRESULT _stdcall GetDataKey(
                        [in] SPDATAKEYLOCATION spdkl, 
                        [out] ISpDataKey** ppDataKey);
        HRESULT _stdcall EnumTokens(
                        [in] LPWSTR pzsReqAttribs, 
                        [in] LPWSTR pszOptAttribs, 
                        [out] IEnumSpObjectTokens** ppEnum);
        HRESULT _stdcall SetDefaultTokenId([in] LPWSTR pszTokenId);
        HRESULT _stdcall GetDefaultTokenId([out] LPWSTR* ppszCoMemTokenId);
    };

    [
      odl,
      uuid(14056581-E16C-11D2-BB90-00C04F8EE6C0),
      helpstring("ISpDataKey Interface"),
      restricted
    ]
    interface ISpDataKey : IUnknown {
        HRESULT _stdcall SetData(
                        [in] LPWSTR pszValueName, 
                        [in] unsigned long cbData, 
                        [in] unsigned char* pData);
        HRESULT _stdcall GetData(
                        [in] LPWSTR pszValueName, 
                        [in] unsigned long* pcbData, 
                        [out] unsigned char* pData);
        HRESULT _stdcall SetStringValue(
                        [in] LPWSTR pszValueName, 
                        [in] LPWSTR pszValue);
        HRESULT _stdcall GetStringValue(
                        [in] LPWSTR pszValueName, 
                        [out] LPWSTR* ppszValue);
        HRESULT _stdcall SetDWORD(
                        [in] LPWSTR pszValueName, 
                        [in] unsigned long dwValue);
        HRESULT _stdcall GetDWORD(
                        [in] LPWSTR pszValueName, 
                        [out] unsigned long* pdwValue);
        HRESULT _stdcall OpenKey(
                        [in] LPWSTR pszSubKeyName, 
                        [out] ISpDataKey** ppSubKey);
        HRESULT _stdcall CreateKey(
                        [in] LPWSTR pszSubKey, 
                        [out] ISpDataKey** ppSubKey);
        HRESULT _stdcall DeleteKey([in] LPWSTR pszSubKey);
        HRESULT _stdcall DeleteValue([in] LPWSTR pszValueName);
        HRESULT _stdcall EnumKeys(
                        [in] unsigned long Index, 
                        [out] LPWSTR* ppszSubKeyName);
        HRESULT _stdcall EnumValues(
                        [in] unsigned long Index, 
                        [out] LPWSTR* ppszValueName);
    };

    typedef enum {
        SPDKL_DefaultLocation = 0,
        SPDKL_CurrentUser = 1,
        SPDKL_LocalMachine = 2,
        SPDKL_CurrentConfig = 5
    } SPDATAKEYLOCATION;

    [
      odl,
      uuid(06B64F9E-7FDA-11D2-B4F2-00C04F797396),
      helpstring("IEnumSpObjectTokens Interface"),
      restricted
    ]
    interface IEnumSpObjectTokens : IUnknown {
        HRESULT _stdcall Next(
                        [in] unsigned long celt, 
                        [out] ISpObjectToken** pelt, 
                        [out] unsigned long* pceltFetched);
        HRESULT _stdcall Skip([in] unsigned long celt);
        HRESULT _stdcall Reset();
        HRESULT _stdcall Clone([out] IEnumSpObjectTokens** ppEnum);
        HRESULT _stdcall Item(
                        [in] unsigned long Index, 
                        [out] ISpObjectToken** ppToken);
        HRESULT _stdcall GetCount([out] unsigned long* pCount);
    };

    [
      odl,
      uuid(14056589-E16C-11D2-BB90-00C04F8EE6C0),
      helpstring("ISpObjectToken Interface"),
      restricted
    ]
    interface ISpObjectToken : ISpDataKey {
        HRESULT _stdcall SetId(
                        LPWSTR pszCategoryId, 
                        [in] LPWSTR pszTokenId, 
                        [in] long fCreateIfNotExist);
        HRESULT _stdcall GetId([out] LPWSTR* ppszCoMemTokenId);
        HRESULT _stdcall GetCategory([out] ISpObjectTokenCategory** ppTokenCategory);
        HRESULT _stdcall CreateInstance(
                        [in] IUnknown* pUnkOuter, 
                        [in] unsigned long dwClsContext, 
                        [in] GUID* riid, 
                        [out] void** ppvObject);
        HRESULT _stdcall GetStorageFileName(
                        [in] GUID* clsidCaller, 
                        [in] LPWSTR pszValueName, 
                        [in] LPWSTR pszFileNameSpecifier, 
                        [in] unsigned long nFolder, 
                        [out] LPWSTR* ppszFilePath);
        HRESULT _stdcall RemoveStorageFileName(
                        [in] GUID* clsidCaller, 
                        [in] LPWSTR pszKeyName, 
                        [in] long fDeleteFile);
        HRESULT _stdcall Remove(GUID* pclsidCaller);
        HRESULT _stdcall IsUISupported(
                        [in] LPWSTR pszTypeOfUI, 
                        [in] void* pvExtraData, 
                        [in] unsigned long cbExtraData, 
                        [in] IUnknown* punkObject, 
                        [out] long* pfSupported);
        HRESULT _stdcall DisplayUI(
                        [in] wireHWND hWndParent, 
                        [in] LPWSTR pszTitle, 
                        [in] LPWSTR pszTypeOfUI, 
                        [in] void* pvExtraData, 
                        [in] unsigned long cbExtraData, 
                        [in] IUnknown* punkObject);
        HRESULT _stdcall MatchesAttributes(
                        [in] LPWSTR pszAttributes, 
                        [out] long* pfMatches);
    };

    [
      uuid(EF411752-3736-4CB4-9C8C-8EF4CCB58EFE),
      helpstring("SpObjectToken Class")
    ]
    coclass SpObjectToken {
        [default] interface ISpeechObjectToken;
        interface ISpObjectToken;
    };

    [
      uuid(96749373-3391-11D2-9EE3-00C04F797396),
      helpstring("SpResourceManger"),
      hidden,
      restricted
    ]
    coclass SpResourceManager {
        [default] interface ISpResourceManager;
    };

    [
      odl,
      uuid(93384E18-5014-43D5-ADBB-A78E055926BD),
      helpstring("ISpResourceManager Interface"),
      restricted
    ]
    interface ISpResourceManager : IServiceProvider {
        HRESULT _stdcall SetObject(
                        [in] GUID* guidServiceId, 
                        [in] IUnknown* punkObject);
        HRESULT _stdcall GetObject(
                        [in] GUID* guidServiceId, 
                        [in] GUID* ObjectCLSID, 
                        [in] GUID* ObjectIID, 
                        [in] long fReleaseWhenLastExternalRefReleased, 
                        [out] void** ppObject);
    };

    [
      odl,
      uuid(6D5140C1-7436-11CE-8034-00AA006009FA)
    ]
    interface IServiceProvider : IUnknown {
        HRESULT _stdcall RemoteQueryService(
                        [in] GUID* guidService, 
                        [in] GUID* riid, 
                        [out] IUnknown** ppvObject);
    };

    [
      uuid(7013943A-E2EC-11D2-A086-00C04F8EF9B5),
      helpstring("FormatConverter Class"),
      hidden,
      restricted
    ]
    coclass SpStreamFormatConverter {
        [default] interface ISpStreamFormatConverter;
    };

    [
      odl,
      uuid(678A932C-EA71-4446-9B41-78FDA6280A29),
      helpstring("ISpStreamFormatConverter Interface"),
      restricted
    ]
    interface ISpStreamFormatConverter : ISpStreamFormat {
        HRESULT _stdcall SetBaseStream(
                        [in] ISpStreamFormat* pStream, 
                        [in] long fSetFormatToBaseStreamFormat, 
                        [in] long fWriteToBaseStream);
        HRESULT _stdcall GetBaseStream([out] ISpStreamFormat** ppStream);
        HRESULT _stdcall SetFormat(
                        [in] GUID* rguidFormatIdOfConvertedStream, 
                        [in] WAVEFORMATEX* pWaveFormatExOfConvertedStream);
        HRESULT _stdcall ResetSeekPosition();
        HRESULT _stdcall ScaleConvertedToBaseOffset(
                        [in] uint64 ullOffsetConvertedStream, 
                        [out] uint64* pullOffsetBaseStream);
        HRESULT _stdcall ScaleBaseToConvertedOffset(
                        [in] uint64 ullOffsetBaseStream, 
                        [out] uint64* pullOffsetConvertedStream);
    };

    [
      odl,
      uuid(BED530BE-2606-4F4D-A1C0-54C5CDA5566F),
      helpstring("ISpStreamFormat Interface"),
      restricted
    ]
    interface ISpStreamFormat : IStream {
        HRESULT _stdcall GetFormat(
                        [in] GUID* pguidFormatId, 
                        [out] WAVEFORMATEX** ppCoMemWaveFormatEx);
    };

    [
      odl,
      uuid(0000000C-0000-0000-C000-000000000046)
    ]
    interface IStream : ISequentialStream {
        HRESULT _stdcall RemoteSeek(
                        [in] _LARGE_INTEGER dlibMove, 
                        [in] unsigned long dwOrigin, 
                        [out] _ULARGE_INTEGER* plibNewPosition);
        HRESULT _stdcall SetSize([in] _ULARGE_INTEGER libNewSize);
        HRESULT _stdcall RemoteCopyTo(
                        [in] IStream* pstm, 
                        [in] _ULARGE_INTEGER cb, 
                        [out] _ULARGE_INTEGER* pcbRead, 
                        [out] _ULARGE_INTEGER* pcbWritten);
        HRESULT _stdcall Commit([in] unsigned long grfCommitFlags);
        HRESULT _stdcall Revert();
        HRESULT _stdcall LockRegion(
                        [in] _ULARGE_INTEGER libOffset, 
                        [in] _ULARGE_INTEGER cb, 
                        [in] unsigned long dwLockType);
        HRESULT _stdcall UnlockRegion(
                        [in] _ULARGE_INTEGER libOffset, 
                        [in] _ULARGE_INTEGER cb, 
                        [in] unsigned long dwLockType);
        HRESULT _stdcall Stat(
                        [out] tagSTATSTG* pstatstg, 
                        [in] unsigned long grfStatFlag);
        HRESULT _stdcall Clone([out] IStream** ppstm);
    };

    [
      odl,
      uuid(0C733A30-2A1C-11CE-ADE5-00AA0044773D)
    ]
    interface ISequentialStream : IUnknown {
        HRESULT _stdcall RemoteRead(
                        [out] unsigned char* pv, 
                        [in] unsigned long cb, 
                        [out] unsigned long* pcbRead);
        HRESULT _stdcall RemoteWrite(
                        [in] unsigned char* pv, 
                        [in] unsigned long cb, 
                        [out] unsigned long* pcbWritten);
    };

    typedef struct tag_LARGE_INTEGER {
                
int64 QuadPart;
    } _LARGE_INTEGER;

    typedef struct tag_ULARGE_INTEGER {
                
uint64 QuadPart;
    } _ULARGE_INTEGER;

    typedef struct tagtagSTATSTG {
                
LPWSTR pwcsName;
                
unsigned long Type;
                
_ULARGE_INTEGER cbSize;
                
_FILETIME mtime;
                
_FILETIME ctime;
                
_FILETIME atime;
                
unsigned long grfMode;
                
unsigned long grfLocksSupported;
                
GUID clsid;
                
unsigned long grfStateBits;
                
unsigned long reserved;
    } tagSTATSTG;

    typedef struct tag_FILETIME {
                
unsigned long dwLowDateTime;
                
unsigned long dwHighDateTime;
    } _FILETIME;

    typedef struct tagWAVEFORMATEX {
                
unsigned short wFormatTag;
                
unsigned short nChannels;
                
unsigned long nSamplesPerSec;
                
unsigned long nAvgBytesPerSec;
                
unsigned short nBlockAlign;
                
unsigned short wBitsPerSample;
                
unsigned short cbSize;
    } WAVEFORMATEX;

    [
      uuid(AB1890A0-E91F-11D2-BB91-00C04F8EE6C0),
      helpstring("SpMMAudioEnum Class"),
      hidden,
      restricted
    ]
    coclass SpMMAudioEnum {
        [default] interface IEnumSpObjectTokens;
    };

    [
      uuid(CF3D2E50-53F2-11D2-960C-00C04F8EE628),
      helpstring("SpMMAudioIn Class")
    ]
    coclass SpMMAudioIn {
        [default] interface ISpeechMMSysAudio;
        interface ISpEventSource;
        interface ISpEventSink;
        interface ISpObjectWithToken;
        interface ISpMMSysAudio;
    };

    [
      odl,
      uuid(BE7A9CCE-5F9E-11D2-960F-00C04F8EE628),
      helpstring("ISpEventSource Interface"),
      restricted
    ]
    interface ISpEventSource : ISpNotifySource {
        HRESULT _stdcall SetInterest(
                        [in] uint64 ullEventInterest, 
                        [in] uint64 ullQueuedInterest);
        HRESULT _stdcall GetEvents(
                        [in] unsigned long ulCount, 
                        [out] SPEVENT* pEventArray, 
                        [out] unsigned long* pulFetched);
        HRESULT _stdcall GetInfo([out] SPEVENTSOURCEINFO* pInfo);
    };

    [
      odl,
      uuid(5EFF4AEF-8487-11D2-961C-00C04F8EE628),
      helpstring("ISpNotifySource Interface"),
      restricted
    ]
    interface ISpNotifySource : IUnknown {
        HRESULT _stdcall SetNotifySink([in] ISpNotifySink* pNotifySink);
        HRESULT _stdcall SetNotifyWindowMessage(
                        [in] wireHWND hWnd, 
                        [in] unsigned int Msg, 
                        [in] UINT_PTR wParam, 
                        [in] LONG_PTR lParam);
        HRESULT _stdcall SetNotifyCallbackFunction(
                        [in] void** pfnCallback, 
                        [in] UINT_PTR wParam, 
                        [in] LONG_PTR lParam);
        HRESULT _stdcall SetNotifyCallbackInterface(
                        [in] void** pSpCallback, 
                        [in] UINT_PTR wParam, 
                        [in] LONG_PTR lParam);
        HRESULT _stdcall SetNotifyWin32Event();
        HRESULT _stdcall WaitForNotifyEvent([in] unsigned long dwMilliseconds);
        void* _stdcall GetNotifyEventHandle();
    };

    typedef struct tagSPEVENT {
                
unsigned short eEventId;
                
unsigned short elParamType;
                
unsigned long ulStreamNum;
                
uint64 ullAudioStreamOffset;
                
UINT_PTR wParam;
                
LONG_PTR lParam;
    } SPEVENT;

    typedef struct tagSPEVENTSOURCEINFO {
                
uint64 ullEventInterest;
                
uint64 ullQueuedInterest;
                
unsigned long ulCount;
    } SPEVENTSOURCEINFO;

    [
      odl,
      uuid(BE7A9CC9-5F9E-11D2-960F-00C04F8EE628),
      helpstring("ISpEventSink Interface"),
      restricted
    ]
    interface ISpEventSink : IUnknown {
        HRESULT _stdcall AddEvents(
                        [in] SPEVENT* pEventArray, 
                        [in] unsigned long ulCount);
        HRESULT _stdcall GetEventInterest([out] uint64* pullEventInterest);
    };

    [
      odl,
      uuid(5B559F40-E952-11D2-BB91-00C04F8EE6C0),
      helpstring("ISpObjectWithToken Interface"),
      restricted
    ]
    interface ISpObjectWithToken : IUnknown {
        HRESULT _stdcall SetObjectToken([in] ISpObjectToken* pToken);
        HRESULT _stdcall GetObjectToken([out] ISpObjectToken** ppToken);
    };

    [
      odl,
      uuid(15806F6E-1D70-4B48-98E6-3B1A007509AB),
      helpstring("ISpMMSysAudio Interface"),
      restricted
    ]
    interface ISpMMSysAudio : ISpAudio {
        HRESULT _stdcall GetDeviceId([out] unsigned int* puDeviceId);
        HRESULT _stdcall SetDeviceId([in] unsigned int uDeviceId);
        HRESULT _stdcall GetMMHandle([out] void** pHandle);
        HRESULT _stdcall GetLineId([out] unsigned int* puLineId);
        HRESULT _stdcall SetLineId([in] unsigned int uLineId);
    };

    [
      odl,
      uuid(C05C768F-FAE8-4EC2-8E07-338321C12452),
      helpstring("ISpAudio Interface"),
      restricted
    ]
    interface ISpAudio : ISpStreamFormat {
        HRESULT _stdcall SetState(
                        [in] SPAUDIOSTATE NewState, 
                        [in] uint64 ullReserved);
        HRESULT _stdcall SetFormat(
                        [in] GUID* rguidFmtId, 
                        [in] WAVEFORMATEX* pWaveFormatEx);
        HRESULT _stdcall GetStatus([out] SPAUDIOSTATUS* pStatus);
        HRESULT _stdcall SetBufferInfo([in] SPAUDIOBUFFERINFO* pBuffInfo);
        HRESULT _stdcall GetBufferInfo([out] SPAUDIOBUFFERINFO* pBuffInfo);
        HRESULT _stdcall GetDefaultFormat(
                        [out] GUID* pFormatId, 
                        [out] WAVEFORMATEX** ppCoMemWaveFormatEx);
        void* _stdcall EventHandle();
        HRESULT _stdcall GetVolumeLevel([out] unsigned long* pLevel);
        HRESULT _stdcall SetVolumeLevel([in] unsigned long Level);
        HRESULT _stdcall GetBufferNotifySize([out] unsigned long* pcbSize);
        HRESULT _stdcall SetBufferNotifySize([in] unsigned long cbSize);
    };

    typedef [public]
    _SPAUDIOSTATE SPAUDIOSTATE;

    typedef enum {
        SPAS_CLOSED = 0,
        SPAS_STOP = 1,
        SPAS_PAUSE = 2,
        SPAS_RUN = 3
    } _SPAUDIOSTATE;

    typedef struct tagSPAUDIOSTATUS {
                
long cbFreeBuffSpace;
                
unsigned long cbNonBlockingIO;
                
SPAUDIOSTATE State;
                
uint64 CurSeekPos;
                
uint64 CurDevicePos;
                
unsigned long dwAudioLevel;
                
unsigned long dwReserved2;
    } SPAUDIOSTATUS;

    typedef struct tagSPAUDIOBUFFERINFO {
                
unsigned long ulMsMinNotification;
                
unsigned long ulMsBufferSize;
                
unsigned long ulMsEventBias;
    } SPAUDIOBUFFERINFO;

    [
      uuid(A8C680EB-3D32-11D2-9EE7-00C04F797396),
      helpstring("SpMMAudioOut Class")
    ]
    coclass SpMMAudioOut {
        [default] interface ISpeechMMSysAudio;
        interface ISpEventSource;
        interface ISpEventSink;
        interface ISpObjectWithToken;
        interface ISpMMSysAudio;
    };

    [
      uuid(715D9C59-4442-11D2-9605-00C04F8EE628),
      helpstring("SpStream Class"),
      hidden,
      restricted
    ]
    coclass SpStream {
        [default] interface ISpStream;
    };

    [
      odl,
      uuid(12E3CCA9-7518-44C5-A5E7-BA5A79CB929E),
      helpstring("ISpStream Interface"),
      restricted
    ]
    interface ISpStream : ISpStreamFormat {
        HRESULT _stdcall SetBaseStream(
                        [in] IStream* pStream, 
                        [in] GUID* rguidFormat, 
                        [in] WAVEFORMATEX* pWaveFormatEx);
        HRESULT _stdcall GetBaseStream([out] IStream** ppStream);
        HRESULT _stdcall BindToFile(
                        [in] LPWSTR pszFileName, 
                        [in] SPFILEMODE eMode, 
                        [in] GUID* pFormatId, 
                        WAVEFORMATEX* pWaveFormatEx, 
                        [in] uint64 ullEventInterest);
        HRESULT _stdcall Close();
    };

    typedef enum {
        SPFM_OPEN_READONLY = 0,
        SPFM_OPEN_READWRITE = 1,
        SPFM_CREATE = 2,
        SPFM_CREATE_ALWAYS = 3,
        SPFM_NUM_MODES = 4
    } SPFILEMODE;

    [
      uuid(96749377-3391-11D2-9EE3-00C04F797396),
      helpstring("SpVoice Class")
    ]
    coclass SpVoice {
        [default] interface ISpeechVoice;
        interface ISpVoice;
        interface ISpPhoneticAlphabetSelection;
        [default, source] dispinterface _ISpeechVoiceEvents;
    };

    [
      odl,
      uuid(6C44DF74-72B9-4992-A1EC-EF996E0422D4),
      helpstring("ISpVoice Interface"),
      restricted
    ]
    interface ISpVoice : ISpEventSource {
        HRESULT _stdcall SetOutput(
                        [in] IUnknown* pUnkOutput, 
                        [in] long fAllowFormatChanges);
        HRESULT _stdcall GetOutputObjectToken([out] ISpObjectToken** ppObjectToken);
        HRESULT _stdcall GetOutputStream([out] ISpStreamFormat** ppStream);
        HRESULT _stdcall Pause();
        HRESULT _stdcall Resume();
        HRESULT _stdcall SetVoice([in] ISpObjectToken* pToken);
        HRESULT _stdcall GetVoice([out] ISpObjectToken** ppToken);
        HRESULT _stdcall Speak(
                        [in] LPWSTR pwcs, 
                        [in] unsigned long dwFlags, 
                        [out] unsigned long* pulStreamNumber);
        HRESULT _stdcall SpeakStream(
                        [in] IStream* pStream, 
                        [in] unsigned long dwFlags, 
                        [out] unsigned long* pulStreamNumber);
        HRESULT _stdcall GetStatus(
                        [out] SPVOICESTATUS* pStatus, 
                        [out] LPWSTR* ppszLastBookmark);
        HRESULT _stdcall Skip(
                        [in] LPWSTR pItemType, 
                        [in] long lNumItems, 
                        [out] unsigned long* pulNumSkipped);
        HRESULT _stdcall SetPriority([in] SPVPRIORITY ePriority);
        HRESULT _stdcall GetPriority([out] SPVPRIORITY* pePriority);
        HRESULT _stdcall SetAlertBoundary([in] SPEVENTENUM eBoundary);
        HRESULT _stdcall GetAlertBoundary([out] SPEVENTENUM* peBoundary);
        HRESULT _stdcall SetRate([in] long RateAdjust);
        HRESULT _stdcall GetRate([out] long* pRateAdjust);
        HRESULT _stdcall SetVolume([in] unsigned short usVolume);
        HRESULT _stdcall GetVolume([out] unsigned short* pusVolume);
        HRESULT _stdcall WaitUntilDone([in] unsigned long msTimeout);
        HRESULT _stdcall SetSyncSpeakTimeout([in] unsigned long msTimeout);
        HRESULT _stdcall GetSyncSpeakTimeout([out] unsigned long* pmsTimeout);
        void* _stdcall SpeakCompleteEvent();
        HRESULT _stdcall IsUISupported(
                        [in] LPWSTR pszTypeOfUI, 
                        [in] void* pvExtraData, 
                        [in] unsigned long cbExtraData, 
                        [out] long* pfSupported);
        HRESULT _stdcall DisplayUI(
                        [in] wireHWND hWndParent, 
                        [in] LPWSTR pszTitle, 
                        [in] LPWSTR pszTypeOfUI, 
                        [in] void* pvExtraData, 
                        [in] unsigned long cbExtraData);
    };

    typedef struct tagSPVOICESTATUS {
                
unsigned long ulCurrentStream;
                
unsigned long ulLastStreamQueued;
                
HRESULT hrLastResult;
                
unsigned long dwRunningState;
                
unsigned long ulInputWordPos;
                
unsigned long ulInputWordLen;
                
unsigned long ulInputSentPos;
                
unsigned long ulInputSentLen;
                
long lBookmarkId;
                
unsigned short PhonemeId;
                
SPVISEMES VisemeId;
                
unsigned long dwReserved1;
                
unsigned long dwReserved2;
    } SPVOICESTATUS;

    typedef enum {
        SP_VISEME_0 = 0,
        SP_VISEME_1 = 1,
        SP_VISEME_2 = 2,
        SP_VISEME_3 = 3,
        SP_VISEME_4 = 4,
        SP_VISEME_5 = 5,
        SP_VISEME_6 = 6,
        SP_VISEME_7 = 7,
        SP_VISEME_8 = 8,
        SP_VISEME_9 = 9,
        SP_VISEME_10 = 10,
        SP_VISEME_11 = 11,
        SP_VISEME_12 = 12,
        SP_VISEME_13 = 13,
        SP_VISEME_14 = 14,
        SP_VISEME_15 = 15,
        SP_VISEME_16 = 16,
        SP_VISEME_17 = 17,
        SP_VISEME_18 = 18,
        SP_VISEME_19 = 19,
        SP_VISEME_20 = 20,
        SP_VISEME_21 = 21
    } SPVISEMES;

    typedef enum {
        SPVPRI_NORMAL = 0,
        SPVPRI_ALERT = 1,
        SPVPRI_OVER = 2
    } SPVPRIORITY;

    typedef enum {
        SPEI_UNDEFINED = 0,
        SPEI_START_INPUT_STREAM = 1,
        SPEI_END_INPUT_STREAM = 2,
        SPEI_VOICE_CHANGE = 3,
        SPEI_TTS_BOOKMARK = 4,
        SPEI_WORD_BOUNDARY = 5,
        SPEI_PHONEME = 6,
        SPEI_SENTENCE_BOUNDARY = 7,
        SPEI_VISEME = 8,
        SPEI_TTS_AUDIO_LEVEL = 9,
        SPEI_TTS_PRIVATE = 15,
        SPEI_MIN_TTS = 1,
        SPEI_MAX_TTS = 15,
        SPEI_END_SR_STREAM = 34,
        SPEI_SOUND_START = 35,
        SPEI_SOUND_END = 36,
        SPEI_PHRASE_START = 37,
        SPEI_RECOGNITION = 38,
        SPEI_HYPOTHESIS = 39,
        SPEI_SR_BOOKMARK = 40,
        SPEI_PROPERTY_NUM_CHANGE = 41,
        SPEI_PROPERTY_STRING_CHANGE = 42,
        SPEI_FALSE_RECOGNITION = 43,
        SPEI_INTERFERENCE = 44,
        SPEI_REQUEST_UI = 45,
        SPEI_RECO_STATE_CHANGE = 46,
        SPEI_ADAPTATION = 47,
        SPEI_START_SR_STREAM = 48,
        SPEI_RECO_OTHER_CONTEXT = 49,
        SPEI_SR_AUDIO_LEVEL = 50,
        SPEI_SR_RETAINEDAUDIO = 51,
        SPEI_SR_PRIVATE = 52,
        SPEI_ACTIVE_CATEGORY_CHANGED = 53,
        SPEI_RESERVED5 = 54,
        SPEI_RESERVED6 = 55,
        SPEI_MIN_SR = 34,
        SPEI_MAX_SR = 55,
        SPEI_RESERVED1 = 30,
        SPEI_RESERVED2 = 33,
        SPEI_RESERVED3 = 63
    } SPEVENTENUM;

    [
      odl,
      uuid(B2745EFD-42CE-48CA-81F1-A96E02538A90),
      helpstring("ISpPhoneticAlphabetSelection Interface"),
      restricted
    ]
    interface ISpPhoneticAlphabetSelection : IUnknown {
        HRESULT _stdcall IsAlphabetUPS([out] long* pfIsUPS);
        HRESULT _stdcall SetAlphabetToUPS([in] long fForceUPS);
    };

    [
      uuid(47206204-5ECA-11D2-960F-00C04F8EE628),
      helpstring("SpSharedRecoContext Class")
    ]
    coclass SpSharedRecoContext {
        [default] interface ISpeechRecoContext;
        interface ISpRecoContext;
        interface ISpRecoContext2;
        interface ISpPhoneticAlphabetSelection;
        [default, source] dispinterface _ISpeechRecoContextEvents;
    };

    [
      odl,
      uuid(F740A62F-7C15-489E-8234-940A33D9272D),
      helpstring("ISpRecoContext Interface"),
      restricted
    ]
    interface ISpRecoContext : ISpEventSource {
        HRESULT _stdcall GetRecognizer([out] ISpRecognizer** ppRecognizer);
        HRESULT _stdcall CreateGrammar(
                        [in] uint64 ullGrammarID, 
                        [out] ISpRecoGrammar** ppGrammar);
        HRESULT _stdcall GetStatus([out] SPRECOCONTEXTSTATUS* pStatus);
        HRESULT _stdcall GetMaxAlternates([in] unsigned long* pcAlternates);
        HRESULT _stdcall SetMaxAlternates([in] unsigned long cAlternates);
        HRESULT _stdcall SetAudioOptions(
                        [in] SPAUDIOOPTIONS Options, 
                        [in] GUID* pAudioFormatId, 
                        [in] WAVEFORMATEX* pWaveFormatEx);
        HRESULT _stdcall GetAudioOptions(
                        [in] SPAUDIOOPTIONS* pOptions, 
                        [out] GUID* pAudioFormatId, 
                        [out] WAVEFORMATEX** ppCoMemWFEX);
        HRESULT _stdcall DeserializeResult(
                        [in] SPSERIALIZEDRESULT* pSerializedResult, 
                        [out] ISpRecoResult** ppResult);
        HRESULT _stdcall Bookmark(
                        [in] SPBOOKMARKOPTIONS Options, 
                        [in] uint64 ullStreamPosition, 
                        [in] LONG_PTR lparamEvent);
        HRESULT _stdcall SetAdaptationData(
                        [in] LPWSTR pAdaptationData, 
                        [in] unsigned long cch);
        HRESULT _stdcall Pause([in] unsigned long dwReserved);
        HRESULT _stdcall Resume([in] unsigned long dwReserved);
        HRESULT _stdcall SetVoice(
                        [in] ISpVoice* pVoice, 
                        [in] long fAllowFormatChanges);
        HRESULT _stdcall GetVoice([out] ISpVoice** ppVoice);
        HRESULT _stdcall SetVoicePurgeEvent([in] uint64 ullEventInterest);
        HRESULT _stdcall GetVoicePurgeEvent([out] uint64* pullEventInterest);
        HRESULT _stdcall SetContextState([in] SPCONTEXTSTATE eContextState);
        HRESULT _stdcall GetContextState([out] SPCONTEXTSTATE* peContextState);
    };

    [
      odl,
      uuid(C2B5F241-DAA0-4507-9E16-5A1EAA2B7A5C),
      helpstring("ISpRecognizer Interface"),
      restricted
    ]
    interface ISpRecognizer : ISpProperties {
        HRESULT _stdcall SetRecognizer([in] ISpObjectToken* pRecognizer);
        HRESULT _stdcall GetRecognizer([out] ISpObjectToken** ppRecognizer);
        HRESULT _stdcall SetInput(
                        [in] IUnknown* pUnkInput, 
                        [in] long fAllowFormatChanges);
        HRESULT _stdcall GetInputObjectToken([out] ISpObjectToken** ppToken);
        HRESULT _stdcall GetInputStream([out] ISpStreamFormat** ppStream);
        HRESULT _stdcall CreateRecoContext([out] ISpRecoContext** ppNewCtxt);
        HRESULT _stdcall GetRecoProfile([out] ISpObjectToken** ppToken);
        HRESULT _stdcall SetRecoProfile([in] ISpObjectToken* pToken);
        HRESULT _stdcall IsSharedInstance();
        HRESULT _stdcall GetRecoState([out] SPRECOSTATE* pState);
        HRESULT _stdcall SetRecoState([in] SPRECOSTATE NewState);
        HRESULT _stdcall GetStatus([out] SPRECOGNIZERSTATUS* pStatus);
        HRESULT _stdcall GetFormat(
                        [in] SPSTREAMFORMATTYPE WaveFormatType, 
                        [out] GUID* pFormatId, 
                        [out] WAVEFORMATEX** ppCoMemWFEX);
        HRESULT _stdcall IsUISupported(
                        [in] LPWSTR pszTypeOfUI, 
                        [in] void* pvExtraData, 
                        [in] unsigned long cbExtraData, 
                        [out] long* pfSupported);
        HRESULT _stdcall DisplayUI(
                        [in] wireHWND hWndParent, 
                        [in] LPWSTR pszTitle, 
                        [in] LPWSTR pszTypeOfUI, 
                        [in] void* pvExtraData, 
                        [in] unsigned long cbExtraData);
        HRESULT _stdcall EmulateRecognition([in] ISpPhrase* pPhrase);
    };

    [
      odl,
      uuid(5B4FB971-B115-4DE1-AD97-E482E3BF6EE4),
      helpstring("ISpProperties Interface"),
      restricted
    ]
    interface ISpProperties : IUnknown {
        HRESULT _stdcall SetPropertyNum(
                        [in] LPWSTR pName, 
                        [in] long lValue);
        HRESULT _stdcall GetPropertyNum(
                        [in] LPWSTR pName, 
                        [out] long* plValue);
        HRESULT _stdcall SetPropertyString(
                        [in] LPWSTR pName, 
                        [in] LPWSTR pValue);
        HRESULT _stdcall GetPropertyString(
                        [in] LPWSTR pName, 
                        [out] LPWSTR* ppCoMemValue);
    };

    typedef enum {
        SPRST_INACTIVE = 0,
        SPRST_ACTIVE = 1,
        SPRST_ACTIVE_ALWAYS = 2,
        SPRST_INACTIVE_WITH_PURGE = 3,
        SPRST_NUM_STATES = 4
    } SPRECOSTATE;

    typedef struct tagSPRECOGNIZERSTATUS {
                
SPAUDIOSTATUS AudioStatus;
                
uint64 ullRecognitionStreamPos;
                
unsigned long ulStreamNumber;
                
unsigned long ulNumActive;
                
GUID ClsidEngine;
                
unsigned long cLangIDs;
                
unsigned short aLangID[20];
                
uint64 ullRecognitionStreamTime;
    } SPRECOGNIZERSTATUS;

    typedef [public]
    SPWAVEFORMATTYPE SPSTREAMFORMATTYPE;

    typedef enum {
        SPWF_INPUT = 0,
        SPWF_SRENGINE = 1
    } SPWAVEFORMATTYPE;

    [
      odl,
      uuid(1A5C0354-B621-4B5A-8791-D306ED379E53),
      helpstring("ISpPhrase Interface"),
      restricted
    ]
    interface ISpPhrase : IUnknown {
        HRESULT _stdcall GetPhrase([out] SPPHRASE** ppCoMemPhrase);
        HRESULT _stdcall GetSerializedPhrase([out] SPSERIALIZEDPHRASE** ppCoMemPhrase);
        HRESULT _stdcall GetText(
                        [in] unsigned long ulStart, 
                        [in] unsigned long ulCount, 
                        [in] long fUseTextReplacements, 
                        [out] LPWSTR* ppszCoMemText, 
                        [out, optional] unsigned char* pbDisplayAttributes);
        HRESULT _stdcall Discard([in] unsigned long dwValueTypes);
    };

    typedef struct tagSPPHRASE {
                
unsigned long cbSize;
                
unsigned short LangId;
                
unsigned short wHomophoneGroupId;
                
uint64 ullGrammarID;
                
uint64 ftStartTime;
                
uint64 ullAudioStreamPosition;
                
unsigned long ulAudioSizeBytes;
                
unsigned long ulRetainedSizeBytes;
                
unsigned long ulAudioSizeTime;
                
SPPHRASERULE Rule;
                
SPPHRASEPROPERTY* pProperties;
                
SPPHRASEELEMENT* pElements;
                
unsigned long cReplacements;
                
SPPHRASEREPLACEMENT* pReplacements;
                
GUID SREngineID;
                
unsigned long ulSREnginePrivateDataSize;
                
unsigned char* pSREnginePrivateData;
                
LPWSTR pSML;
                
SPSEMANTICERRORINFO* pSemanticErrorInfo;
                
SPSEMANTICFORMAT SemanticTagFormat;
    } SPPHRASE;

    typedef struct tagSPPHRASERULE {
                
LPWSTR pszName;
                
unsigned long ulId;
                
unsigned long ulFirstElement;
                
unsigned long ulCountOfElements;
                
SPPHRASERULE* pNextSibling;
                
SPPHRASERULE* pFirstChild;
                
single SREngineConfidence;
                
char Confidence;
    } SPPHRASERULE;

    typedef struct tagSPPHRASEPROPERTY {
                
LPWSTR pszName;
                
__MIDL___MIDL_itf_sapi_0000_0020_0001 __MIDL____MIDL_itf_sapi_0000_00200001;
                
LPWSTR pszValue;
                
VARIANT vValue;
                
unsigned long ulFirstElement;
                
unsigned long ulCountOfElements;
                
SPPHRASEPROPERTY* pNextSibling;
                
SPPHRASEPROPERTY* pFirstChild;
                
single SREngineConfidence;
                
char Confidence;
    } SPPHRASEPROPERTY;

    typedef union tag__MIDL___MIDL_itf_sapi_0000_0020_0001 {
                
unsigned long ulId;
                
__MIDL___MIDL_itf_sapi_0000_0020_0002 __MIDL____MIDL_itf_sapi_0000_00200000;
    } __MIDL___MIDL_itf_sapi_0000_0020_0001;

    typedef struct tag__MIDL___MIDL_itf_sapi_0000_0020_0002 {
                
unsigned char bType;
                
unsigned char bReserved;
                
unsigned short usArrayIndex;
    } __MIDL___MIDL_itf_sapi_0000_0020_0002;

    typedef struct tagSPPHRASEELEMENT {
                
unsigned long ulAudioTimeOffset;
                
unsigned long ulAudioSizeTime;
                
unsigned long ulAudioStreamOffset;
                
unsigned long ulAudioSizeBytes;
                
unsigned long ulRetainedStreamOffset;
                
unsigned long ulRetainedSizeBytes;
                
LPWSTR pszDisplayText;
                
LPWSTR pszLexicalForm;
                
unsigned short* pszPronunciation;
                
unsigned char bDisplayAttributes;
                
char RequiredConfidence;
                
char ActualConfidence;
                
unsigned char reserved;
                
single SREngineConfidence;
    } SPPHRASEELEMENT;

    typedef struct tagSPPHRASEREPLACEMENT {
                
unsigned char bDisplayAttributes;
                
LPWSTR pszReplacementText;
                
unsigned long ulFirstElement;
                
unsigned long ulCountOfElements;
    } SPPHRASEREPLACEMENT;

    typedef struct tagSPSEMANTICERRORINFO {
                
unsigned long ulLineNumber;
                
LPWSTR pszScriptLine;
                
LPWSTR pszSource;
                
LPWSTR pszDescription;
                
HRESULT hrResultCode;
    } SPSEMANTICERRORINFO;

    typedef enum {
        SPSMF_SAPI_PROPERTIES = 0,
        SPSMF_SRGS_SEMANTICINTERPRETATION_MS = 1,
        SPSMF_SRGS_SAPIPROPERTIES = 2,
        SPSMF_UPS = 4,
        SPSMF_SRGS_SEMANTICINTERPRETATION_W3C = 8
    } SPSEMANTICFORMAT;

    typedef struct tagSPSERIALIZEDPHRASE {
                
unsigned long ulSerializedSize;
    } SPSERIALIZEDPHRASE;

    [
      odl,
      uuid(2177DB29-7F45-47D0-8554-067E91C80502),
      helpstring("ISpRecoGrammar Interface"),
      restricted
    ]
    interface ISpRecoGrammar : ISpGrammarBuilder {
        HRESULT _stdcall GetGrammarId([out] uint64* pullGrammarId);
        HRESULT _stdcall GetRecoContext([out] ISpRecoContext** ppRecoCtxt);
        HRESULT _stdcall LoadCmdFromFile(
                        [in] LPWSTR pszFileName, 
                        [in] SPLOADOPTIONS Options);
        HRESULT _stdcall LoadCmdFromObject(
                        [in] GUID* rcid, 
                        [in] LPWSTR pszGrammarName, 
                        [in] SPLOADOPTIONS Options);
        HRESULT _stdcall LoadCmdFromResource(
                        [in] void* hModule, 
                        [in] LPWSTR pszResourceName, 
                        [in] LPWSTR pszResourceType, 
                        [in] unsigned short wLanguage, 
                        [in] SPLOADOPTIONS Options);
        HRESULT _stdcall LoadCmdFromMemory(
                        [in] SPBINARYGRAMMAR* pGrammar, 
                        [in] SPLOADOPTIONS Options);
        HRESULT _stdcall LoadCmdFromProprietaryGrammar(
                        [in] GUID* rguidParam, 
                        [in] LPWSTR pszStringParam, 
                        [in] void* pvDataPrarm, 
                        [in] unsigned long cbDataSize, 
                        [in] SPLOADOPTIONS Options);
        HRESULT _stdcall SetRuleState(
                        [in] LPWSTR pszName, 
                        [in] void* pReserved, 
                        [in] SPRULESTATE NewState);
        HRESULT _stdcall SetRuleIdState(
                        [in] unsigned long ulRuleId, 
                        [in] SPRULESTATE NewState);
        HRESULT _stdcall LoadDictation(
                        [in] LPWSTR pszTopicName, 
                        [in] SPLOADOPTIONS Options);
        HRESULT _stdcall UnloadDictation();
        HRESULT _stdcall SetDictationState([in] SPRULESTATE NewState);
        HRESULT _stdcall SetWordSequenceData(
                        [in] unsigned short* pText, 
                        [in] unsigned long cchText, 
                        [in] SPTEXTSELECTIONINFO* pInfo);
        HRESULT _stdcall SetTextSelection([in] SPTEXTSELECTIONINFO* pInfo);
        HRESULT _stdcall IsPronounceable(
                        [in] LPWSTR pszWord, 
                        [out] SPWORDPRONOUNCEABLE* pWordPronounceable);
        HRESULT _stdcall SetGrammarState([in] SPGRAMMARSTATE eGrammarState);
        HRESULT _stdcall SaveCmd(
                        [in] IStream* pStream, 
                        [out, optional] LPWSTR* ppszCoMemErrorText);
        HRESULT _stdcall GetGrammarState([out] SPGRAMMARSTATE* peGrammarState);
    };

    [
      odl,
      uuid(8137828F-591A-4A42-BE58-49EA7EBAAC68),
      helpstring("ISpGrammarBuilder Interface"),
      restricted
    ]
    interface ISpGrammarBuilder : IUnknown {
        HRESULT _stdcall ResetGrammar([in] unsigned short NewLanguage);
        HRESULT _stdcall GetRule(
                        [in] LPWSTR pszRuleName, 
                        [in] unsigned long dwRuleId, 
                        [in] unsigned long dwAttributes, 
                        [in] long fCreateIfNotExist, 
                        [out] void** phInitialState);
        HRESULT _stdcall ClearRule([in] void* hState);
        HRESULT _stdcall CreateNewState(
                        [in] void* hState, 
                        [out] void** phState);
        HRESULT _stdcall AddWordTransition(
                        [in] void* hFromState, 
                        [in] void* hToState, 
                        [in] LPWSTR psz, 
                        [in] LPWSTR pszSeparators, 
                        [in] SPGRAMMARWORDTYPE eWordType, 
                        [in] single Weight, 
                        [in] SPPROPERTYINFO* pPropInfo);
        HRESULT _stdcall AddRuleTransition(
                        [in] void* hFromState, 
                        [in] void* hToState, 
                        [in] void* hRule, 
                        [in] single Weight, 
                        [in] SPPROPERTYINFO* pPropInfo);
        HRESULT _stdcall AddResource(
                        [in] void* hRuleState, 
                        [in] LPWSTR pszResourceName, 
                        [in] LPWSTR pszResourceValue);
        HRESULT _stdcall Commit([in] unsigned long dwReserved);
    };

    typedef enum {
        SPWT_DISPLAY = 0,
        SPWT_LEXICAL = 1,
        SPWT_PRONUNCIATION = 2,
        SPWT_LEXICAL_NO_SPECIAL_CHARS = 3
    } SPGRAMMARWORDTYPE;

    typedef [public]
    tagSPPROPERTYINFO SPPROPERTYINFO;

    typedef struct tagtagSPPROPERTYINFO {
                
LPWSTR pszName;
                
unsigned long ulId;
                
LPWSTR pszValue;
                
VARIANT vValue;
    } tagSPPROPERTYINFO;

    typedef enum {
        SPLO_STATIC = 0,
        SPLO_DYNAMIC = 1
    } SPLOADOPTIONS;

    typedef struct tagSPBINARYGRAMMAR {
                
unsigned long ulTotalSerializedSize;
    } SPBINARYGRAMMAR;

    typedef enum {
        SPRS_INACTIVE = 0,
        SPRS_ACTIVE = 1,
        SPRS_ACTIVE_WITH_AUTO_PAUSE = 3,
        SPRS_ACTIVE_USER_DELIMITED = 4
    } SPRULESTATE;

    typedef [public]
    tagSPTEXTSELECTIONINFO SPTEXTSELECTIONINFO;

    typedef struct tagtagSPTEXTSELECTIONINFO {
                
unsigned long ulStartActiveOffset;
                
unsigned long cchActiveChars;
                
unsigned long ulStartSelection;
                
unsigned long cchSelection;
    } tagSPTEXTSELECTIONINFO;

    typedef enum {
        SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = 0,
        SPWP_UNKNOWN_WORD_PRONOUNCEABLE = 1,
        SPWP_KNOWN_WORD_PRONOUNCEABLE = 2
    } SPWORDPRONOUNCEABLE;

    typedef enum {
        SPGS_DISABLED = 0,
        SPGS_ENABLED = 1,
        SPGS_EXCLUSIVE = 3
    } SPGRAMMARSTATE;

    typedef struct tagSPRECOCONTEXTSTATUS {
                
SPINTERFERENCE eInterference;
                
unsigned short szRequestTypeOfUI[255];
                
unsigned long dwReserved1;
                
unsigned long dwReserved2;
    } SPRECOCONTEXTSTATUS;

    typedef enum {
        SPINTERFERENCE_NONE = 0,
        SPINTERFERENCE_NOISE = 1,
        SPINTERFERENCE_NOSIGNAL = 2,
        SPINTERFERENCE_TOOLOUD = 3,
        SPINTERFERENCE_TOOQUIET = 4,
        SPINTERFERENCE_TOOFAST = 5,
        SPINTERFERENCE_TOOSLOW = 6,
        SPINTERFERENCE_LATENCY_WARNING = 7,
        SPINTERFERENCE_LATENCY_TRUNCATE_BEGIN = 8,
        SPINTERFERENCE_LATENCY_TRUNCATE_END = 9
    } SPINTERFERENCE;

    typedef enum {
        SPAO_NONE = 0,
        SPAO_RETAIN_AUDIO = 1
    } SPAUDIOOPTIONS;

    typedef struct tagSPSERIALIZEDRESULT {
                
unsigned long ulSerializedSize;
    } SPSERIALIZEDRESULT;

    [
      odl,
      uuid(20B053BE-E235-43CD-9A2A-8D17A48B7842),
      helpstring("ISpRecoResult Interface"),
      restricted
    ]
    interface ISpRecoResult : ISpPhrase {
        HRESULT _stdcall GetResultTimes([out] SPRECORESULTTIMES* pTimes);
        HRESULT _stdcall GetAlternates(
                        [in] unsigned long ulStartElement, 
                        [in] unsigned long cElements, 
                        [in] unsigned long ulRequestCount, 
                        [out] ISpPhraseAlt** ppPhrases, 
                        [out] unsigned long* pcPhrasesReturned);
        HRESULT _stdcall GetAudio(
                        [in] unsigned long ulStartElement, 
                        [in] unsigned long cElements, 
                        [out] ISpStreamFormat** ppStream);
        HRESULT _stdcall SpeakAudio(
                        [in] unsigned long ulStartElement, 
                        [in] unsigned long cElements, 
                        [in] unsigned long dwFlags, 
                        [out] unsigned long* pulStreamNumber);
        HRESULT _stdcall Serialize([out] SPSERIALIZEDRESULT** ppCoMemSerializedResult);
        HRESULT _stdcall ScaleAudio(
                        [in] GUID* pAudioFormatId, 
                        [in] WAVEFORMATEX* pWaveFormatEx);
        HRESULT _stdcall GetRecoContext([out] ISpRecoContext** ppRecoContext);
    };

    typedef struct tagSPRECORESULTTIMES {
                
_FILETIME ftStreamTime;
                
uint64 ullLength;
                
unsigned long dwTickCount;
                
uint64 ullStart;
    } SPRECORESULTTIMES;

    [
      odl,
      uuid(8FCEBC98-4E49-4067-9C6C-D86A0E092E3D),
      helpstring("ISpPhraseAlt Interface"),
      restricted
    ]
    interface ISpPhraseAlt : ISpPhrase {
        HRESULT _stdcall GetAltInfo(
                        [out] ISpPhrase** ppParent, 
                        [out] unsigned long* pulStartElementInParent, 
                        [out] unsigned long* pcElementsInParent, 
                        [out] unsigned long* pcElementsInAlt);
        HRESULT _stdcall Commit();
    };

    typedef enum {
        SPBO_NONE = 0,
        SPBO_PAUSE = 1,
        SPBO_AHEAD = 2,
        SPBO_TIME_UNITS = 4
    } SPBOOKMARKOPTIONS;

    typedef enum {
        SPCS_DISABLED = 0,
        SPCS_ENABLED = 1
    } SPCONTEXTSTATE;

    [
      odl,
      uuid(BEAD311C-52FF-437F-9464-6B21054CA73D),
      helpstring("ISpRecoContext2 Interface"),
      restricted
    ]
    interface ISpRecoContext2 : IUnknown {
        HRESULT _stdcall SetGrammarOptions([in] unsigned long eGrammarOptions);
        HRESULT _stdcall GetGrammarOptions([out] unsigned long* peGrammarOptions);
        HRESULT _stdcall SetAdaptationData2(
                        [in] LPWSTR pAdaptationData, 
                        [in] unsigned long cch, 
                        [in] LPWSTR pTopicName, 
                        [in] unsigned long eAdaptationSettings, 
                        [in] SPADAPTATIONRELEVANCE eRelevance);
    };

    typedef enum {
        SPAR_Unknown = 0,
        SPAR_Low = 1,
        SPAR_Medium = 2,
        SPAR_High = 3
    } SPADAPTATIONRELEVANCE;

    [
      uuid(41B89B6B-9399-11D2-9623-00C04F8EE628),
      helpstring("SpInprocRecognizer Class")
    ]
    coclass SpInprocRecognizer {
        [default] interface ISpeechRecognizer;
        interface ISpRecognizer;
        interface ISpRecognizer2;
        interface ISpRecognizer3;
        interface ISpSerializeState;
    };

    [
      odl,
      uuid(8FC6D974-C81E-4098-93C5-0147F61ED4D3),
      helpstring("ISpRecognizer2 Interface"),
      restricted
    ]
    interface ISpRecognizer2 : IUnknown {
        HRESULT _stdcall EmulateRecognitionEx(
                        [in] ISpPhrase* pPhrase, 
                        [in] unsigned long dwCompareFlags);
        HRESULT _stdcall SetTrainingState(
                        [in] long fDoingTraining, 
                        [in] long fAdaptFromTrainingData);
        HRESULT _stdcall ResetAcousticModelAdaptation();
    };

    [
      odl,
      uuid(DF1B943C-5838-4AA2-8706-D7CD5B333499),
      helpstring("ISpRecognizer3 Interface"),
      restricted
    ]
    interface ISpRecognizer3 : IUnknown {
        HRESULT _stdcall GetCategory(
                        [in] SPCATEGORYTYPE categoryType, 
                        [out] ISpRecoCategory** ppCategory);
        HRESULT _stdcall SetActiveCategory([in] ISpRecoCategory* pCategory);
        HRESULT _stdcall GetActiveCategory([out] ISpRecoCategory** ppCategory);
    };

    typedef enum {
        SPCT_COMMAND = 0,
        SPCT_DICTATION = 1,
        SPCT_SLEEP = 2,
        SPCT_SUB_COMMAND = 3,
        SPCT_SUB_DICTATION = 4
    } SPCATEGORYTYPE;

    [
      odl,
      uuid(DA0CD0F9-14A2-4F09-8C2A-85CC48979345),
      helpstring("ISpRecoCategory Interface"),
      restricted
    ]
    interface ISpRecoCategory : IUnknown {
        HRESULT _stdcall GetType([out] SPCATEGORYTYPE* peCategoryType);
    };

    [
      odl,
      uuid(21B501A0-0EC7-46C9-92C3-A2BC784C54B9),
      helpstring("ISpSerializeState Interface"),
      restricted
    ]
    interface ISpSerializeState : IUnknown {
        HRESULT _stdcall GetSerializedState(
                        [out] unsigned char** ppbData, 
                        [out] unsigned long* pulSize, 
                        [in] unsigned long dwReserved);
        HRESULT _stdcall SetSerializedState(
                        [in] unsigned char* pbData, 
                        [in] unsigned long ulSize, 
                        [in] unsigned long dwReserved);
    };

    [
      uuid(3BEE4890-4FE9-4A37-8C1E-5E7E12791C1F),
      helpstring("SpSharedRecognizer Class")
    ]
    coclass SpSharedRecognizer {
        [default] interface ISpeechRecognizer;
        interface ISpRecognizer;
        interface ISpRecognizer2;
        interface ISpRecognizer3;
        interface ISpSerializeState;
    };

    [
      uuid(0655E396-25D0-11D3-9C26-00C04F8EF87C),
      helpstring("SpLexicon Class")
    ]
    coclass SpLexicon {
        [default] interface ISpeechLexicon;
        interface ISpLexicon;
        interface ISpPhoneticAlphabetSelection;
    };

    [
      odl,
      uuid(DA41A7C2-5383-4DB2-916B-6C1719E3DB58),
      helpstring("ISpLexicon Interface"),
      restricted
    ]
    interface ISpLexicon : IUnknown {
        HRESULT _stdcall GetPronunciations(
                        [in] LPWSTR pszWord, 
                        [in] unsigned short LangId, 
                        [in] unsigned long dwFlags, 
                        [in, out] SPWORDPRONUNCIATIONLIST* pWordPronunciationList);
        HRESULT _stdcall AddPronunciation(
                        [in] LPWSTR pszWord, 
                        [in] unsigned short LangId, 
                        [in] SPPARTOFSPEECH ePartOfSpeech, 
                        [in] LPWSTR pszPronunciation);
        HRESULT _stdcall RemovePronunciation(
                        [in] LPWSTR pszWord, 
                        [in] unsigned short LangId, 
                        [in] SPPARTOFSPEECH ePartOfSpeech, 
                        [in] LPWSTR pszPronunciation);
        HRESULT _stdcall GetGeneration([out] unsigned long* pdwGeneration);
        HRESULT _stdcall GetGenerationChange(
                        [in] unsigned long dwFlags, 
                        [in, out] unsigned long* pdwGeneration, 
                        [in, out] SPWORDLIST* pWordList);
        HRESULT _stdcall GetWords(
                        [in] unsigned long dwFlags, 
                        [in, out] unsigned long* pdwGeneration, 
                        [in, out] unsigned long* pdwCookie, 
                        [in, out] SPWORDLIST* pWordList);
    };

    typedef struct tagSPWORDPRONUNCIATIONLIST {
                
unsigned long ulSize;
                
unsigned char* pvBuffer;
                
SPWORDPRONUNCIATION* pFirstWordPronunciation;
    } SPWORDPRONUNCIATIONLIST;

    typedef struct tagSPWORDPRONUNCIATION {
                
SPWORDPRONUNCIATION* pNextWordPronunciation;
                
SPLEXICONTYPE eLexiconType;
                
unsigned short LangId;
                
unsigned short wPronunciationFlags;
                
SPPARTOFSPEECH ePartOfSpeech;
                
unsigned short szPronunciation[1];
    } SPWORDPRONUNCIATION;

    typedef enum {
        eLEXTYPE_USER = 1,
        eLEXTYPE_APP = 2,
        eLEXTYPE_VENDORLEXICON = 4,
        eLEXTYPE_LETTERTOSOUND = 8,
        eLEXTYPE_MORPHOLOGY = 16,
        eLEXTYPE_RESERVED4 = 32,
        eLEXTYPE_USER_SHORTCUT = 64,
        eLEXTYPE_RESERVED6 = 128,
        eLEXTYPE_RESERVED7 = 256,
        eLEXTYPE_RESERVED8 = 512,
        eLEXTYPE_RESERVED9 = 1024,
        eLEXTYPE_RESERVED10 = 2048,
        eLEXTYPE_PRIVATE1 = 4096,
        eLEXTYPE_PRIVATE2 = 8192,
        eLEXTYPE_PRIVATE3 = 16384,
        eLEXTYPE_PRIVATE4 = 32768,
        eLEXTYPE_PRIVATE5 = 0x00010000,
        eLEXTYPE_PRIVATE6 = 0x00020000,
        eLEXTYPE_PRIVATE7 = 0x00040000,
        eLEXTYPE_PRIVATE8 = 0x00080000,
        eLEXTYPE_PRIVATE9 = 0x00100000,
        eLEXTYPE_PRIVATE10 = 0x00200000,
        eLEXTYPE_PRIVATE11 = 0x00400000,
        eLEXTYPE_PRIVATE12 = 0x00800000,
        eLEXTYPE_PRIVATE13 = 0x01000000,
        eLEXTYPE_PRIVATE14 = 0x02000000,
        eLEXTYPE_PRIVATE15 = 0x04000000,
        eLEXTYPE_PRIVATE16 = 0x08000000,
        eLEXTYPE_PRIVATE17 = 0x10000000,
        eLEXTYPE_PRIVATE18 = 0x20000000,
        eLEXTYPE_PRIVATE19 = 0x40000000,
        eLEXTYPE_PRIVATE20 = 0x80000000
    } SPLEXICONTYPE;

    typedef enum {
        SPPS_NotOverriden = 0xffffffff,
        SPPS_Unknown = 0,
        SPPS_Noun = 4096,
        SPPS_Verb = 8192,
        SPPS_Modifier = 12288,
        SPPS_Function = 16384,
        SPPS_Interjection = 20480,
        SPPS_Noncontent = 24576,
        SPPS_LMA = 28672,
        SPPS_SuppressWord = 61440
    } SPPARTOFSPEECH;

    typedef struct tagSPWORDLIST {
                
unsigned long ulSize;
                
unsigned char* pvBuffer;
                
SPWORD* pFirstWord;
    } SPWORDLIST;

    typedef struct tagSPWORD {
                
SPWORD* pNextWord;
                
unsigned short LangId;
                
unsigned short wReserved;
                
SPWORDTYPE eWordType;
                
LPWSTR pszWord;
                
SPWORDPRONUNCIATION* pFirstWordPronunciation;
    } SPWORD;

    typedef enum {
        eWORDTYPE_ADDED = 1,
        eWORDTYPE_DELETED = 2
    } SPWORDTYPE;

    [
      uuid(C9E37C15-DF92-4727-85D6-72E5EEB6995A),
      helpstring("SpUnCompressedLexicon Class")
    ]
    coclass SpUnCompressedLexicon {
        [default] interface ISpeechLexicon;
        interface ISpLexicon;
        interface ISpObjectWithToken;
        interface ISpPhoneticAlphabetSelection;
    };

    [
      uuid(90903716-2F42-11D3-9C26-00C04F8EF87C),
      helpstring("SpCompressedLexicon Class"),
      hidden,
      restricted
    ]
    coclass SpCompressedLexicon {
        [default] interface ISpLexicon;
        interface ISpObjectWithToken;
    };

    [
      uuid(0D722F1A-9FCF-4E62-96D8-6DF8F01A26AA),
      helpstring("SpShortcut Class")
    ]
    coclass SpShortcut {
        [default] interface ISpShortcut;
        interface ISpObjectWithToken;
    };

    [
      odl,
      uuid(3DF681E2-EA56-11D9-8BDE-F66BAD1E3F3A),
      helpstring("ISpShortcut Interface"),
      restricted
    ]
    interface ISpShortcut : IUnknown {
        HRESULT _stdcall AddShortcut(
                        [in] LPWSTR pszDisplay, 
                        [in] unsigned short LangId, 
                        [in] LPWSTR pszSpoken, 
                        [in] SPSHORTCUTTYPE shType);
        HRESULT _stdcall RemoveShortcut(
                        [in] LPWSTR pszDisplay, 
                        [in] unsigned short LangId, 
                        [in] LPWSTR pszSpoken, 
                        [in] SPSHORTCUTTYPE shType);
        HRESULT _stdcall GetShortcuts(
                        [in] unsigned short LangId, 
                        [in, out] SPSHORTCUTPAIRLIST* pShortcutpairList);
        HRESULT _stdcall GetGeneration([out] unsigned long* pdwGeneration);
        HRESULT _stdcall GetWordsFromGenerationChange(
                        [in, out] unsigned long* pdwGeneration, 
                        [in, out] SPWORDLIST* pWordList);
        HRESULT _stdcall GetWords(
                        [in, out] unsigned long* pdwGeneration, 
                        [in, out] unsigned long* pdwCookie, 
                        [in, out] SPWORDLIST* pWordList);
        HRESULT _stdcall GetShortcutsForGeneration(
                        [in, out] unsigned long* pdwGeneration, 
                        [in, out] unsigned long* pdwCookie, 
                        [in, out] SPSHORTCUTPAIRLIST* pShortcutpairList);
        HRESULT _stdcall GetGenerationChange(
                        [in, out] unsigned long* pdwGeneration, 
                        [in, out] SPSHORTCUTPAIRLIST* pShortcutpairList);
    };

    typedef enum {
        SPSHT_NotOverriden = 0xffffffff,
        SPSHT_Unknown = 0,
        SPSHT_EMAIL = 4096,
        SPSHT_OTHER = 8192,
        SPPS_RESERVED1 = 12288,
        SPPS_RESERVED2 = 16384,
        SPPS_RESERVED3 = 20480,
        SPPS_RESERVED4 = 61440
    } SPSHORTCUTTYPE;

    typedef struct tagSPSHORTCUTPAIRLIST {
                
unsigned long ulSize;
                
unsigned char* pvBuffer;
                
SPSHORTCUTPAIR* pFirstShortcutPair;
    } SPSHORTCUTPAIRLIST;

    typedef struct tagSPSHORTCUTPAIR {
                
SPSHORTCUTPAIR* pNextSHORTCUTPAIR;
                
unsigned short LangId;
                
SPSHORTCUTTYPE shType;
                
LPWSTR pszDisplay;
                
LPWSTR pszSpoken;
    } SPSHORTCUTPAIR;

    [
      uuid(9185F743-1143-4C28-86B5-BFF14F20E5C8),
      helpstring("SpPhoneConverter Class")
    ]
    coclass SpPhoneConverter {
        [default] interface ISpeechPhoneConverter;
        interface ISpPhoneConverter;
        interface ISpPhoneticAlphabetSelection;
    };

    [
      odl,
      uuid(8445C581-0CAC-4A38-ABFE-9B2CE2826455),
      helpstring("ISpPhoneConverter Interface"),
      restricted
    ]
    interface ISpPhoneConverter : ISpObjectWithToken {
        HRESULT _stdcall PhoneToId(
                        [in] LPWSTR pszPhone, 
                        [out] unsigned short* pId);
        HRESULT _stdcall IdToPhone(
                        [in] LPWSTR pId, 
                        [out] unsigned short* pszPhone);
    };

    [
      uuid(4F414126-DFE3-4629-99EE-797978317EAD),
      helpstring("SpPhoneticAlphabetConverter Class")
    ]
    coclass SpPhoneticAlphabetConverter {
        [default] interface ISpPhoneticAlphabetConverter;
    };

    [
      odl,
      uuid(133ADCD4-19B4-4020-9FDC-842E78253B17),
      helpstring("ISpPhoneticAlphabetConverter Interface"),
      restricted
    ]
    interface ISpPhoneticAlphabetConverter : IUnknown {
        HRESULT _stdcall GetLangId([out] unsigned short* pLangID);
        HRESULT _stdcall SetLangId([in] unsigned short LangId);
        HRESULT _stdcall SAPI2UPS(
                        [in] unsigned short* pszSAPIId, 
                        [out] unsigned short* pszUPSId, 
                        [in] unsigned long cMaxLength);
        HRESULT _stdcall UPS2SAPI(
                        [in] unsigned short* pszUPSId, 
                        [out] unsigned short* pszSAPIId, 
                        [in] unsigned long cMaxLength);
        HRESULT _stdcall GetMaxConvertLength(
                        [in] unsigned long cSrcLength, 
                        [in] long bSAPI2UPS, 
                        [out] unsigned long* pcMaxDestLength);
    };

    [
      uuid(455F24E9-7396-4A16-9715-7C0FDBE3EFE3),
      helpstring("SpNullPhoneConverter Class"),
      hidden,
      restricted
    ]
    coclass SpNullPhoneConverter {
        [default] interface ISpPhoneConverter;
    };

    [
      uuid(0F92030A-CBFD-4AB8-A164-FF5985547FF6),
      helpstring("SpTextSelectionInformation Class")
    ]
    coclass SpTextSelectionInformation {
        [default] interface ISpeechTextSelectionInformation;
    };

    [
      uuid(C23FC28D-C55F-4720-8B32-91F73C2BD5D1),
      helpstring("SpPhraseInfoBuilder Class")
    ]
    coclass SpPhraseInfoBuilder {
        [default] interface ISpeechPhraseInfoBuilder;
    };

    [
      uuid(9EF96870-E160-4792-820D-48CF0649E4EC),
      helpstring("SpAudioFormat Class")
    ]
    coclass SpAudioFormat {
        [default] interface ISpeechAudioFormat;
    };

    [
      uuid(C79A574C-63BE-44B9-801F-283F87F898BE),
      helpstring("SpWaveFormatEx Class")
    ]
    coclass SpWaveFormatEx {
        [default] interface ISpeechWaveFormatEx;
    };

    [
      uuid(73AD6842-ACE0-45E8-A4DD-8795881A2C2A),
      helpstring("SpInProcRecoContext Class")
    ]
    coclass SpInProcRecoContext {
        [default] interface ISpeechRecoContext;
        interface ISpRecoContext;
        interface ISpRecoContext2;
        interface ISpPhoneticAlphabetSelection;
        [default, source] dispinterface _ISpeechRecoContextEvents;
    };

    [
      uuid(8DBEF13F-1948-4AA8-8CF0-048EEBED95D8),
      helpstring("SpCustomStream Class")
    ]
    coclass SpCustomStream {
        [default] interface ISpeechCustomStream;
        interface ISpStream;
    };

    [
      uuid(947812B3-2AE1-4644-BA86-9E90DED7EC91),
      helpstring("SpFileStream Class")
    ]
    coclass SpFileStream {
        [default] interface ISpeechFileStream;
        interface ISpStream;
    };

    [
      uuid(5FB7EF7D-DFF4-468A-B6B7-2FCBD188F994),
      helpstring("SpMemoryStream Class")
    ]
    coclass SpMemoryStream {
        [default] interface ISpeechMemoryStream;
        interface ISpStream;
    };

    [
      odl,
      uuid(AE39362B-45A8-4074-9B9E-CCF49AA2D0B6),
      helpstring("ISpXMLRecoResult Interface"),
      restricted
    ]
    interface ISpXMLRecoResult : ISpRecoResult {
        HRESULT _stdcall GetXMLResult(
                        [out] LPWSTR* ppszCoMemXMLResult, 
                        [in] SPXMLRESULTOPTIONS Options);
        HRESULT _stdcall GetXMLErrorInfo([out] SPSEMANTICERRORINFO* pSemanticErrorInfo);
    };

    [
      odl,
      uuid(4B37BC9E-9ED6-44A3-93D3-18F022B79EC3),
      helpstring("ISpRecoGrammar2 Interface"),
      restricted
    ]
    interface ISpRecoGrammar2 : IUnknown {
        HRESULT _stdcall GetRules(
                        [out] SPRULE** ppCoMemRules, 
                        [out] unsigned int* puNumRules);
        HRESULT _stdcall LoadCmdFromFile2(
                        [in] LPWSTR pszFileName, 
                        [in] SPLOADOPTIONS Options, 
                        [in] LPWSTR pszSharingUri, 
                        [in] LPWSTR pszBaseUri);
        HRESULT _stdcall LoadCmdFromMemory2(
                        [in] SPBINARYGRAMMAR* pGrammar, 
                        [in] SPLOADOPTIONS Options, 
                        [in] LPWSTR pszSharingUri, 
                        [in] LPWSTR pszBaseUri);
        HRESULT _stdcall SetRulePriority(
                        [in] LPWSTR pszRuleName, 
                        [in] unsigned long ulRuleId, 
                        [in] int nRulePriority);
        HRESULT _stdcall SetRuleWeight(
                        [in] LPWSTR pszRuleName, 
                        [in] unsigned long ulRuleId, 
                        [in] single flWeight);
        HRESULT _stdcall SetDictationWeight([in] single flWeight);
        HRESULT _stdcall SetGrammarLoader([in] ISpeechResourceLoader* pLoader);
        HRESULT _stdcall SetSMLSecurityManager([in] IInternetSecurityManager* pSMLSecurityManager);
    };

    typedef struct tagSPRULE {
                
LPWSTR pszRuleName;
                
unsigned long ulRuleId;
                
unsigned long dwAttributes;
    } SPRULE;

    [
      odl,
      uuid(B9AC5783-FCD0-4B21-B119-B4F8DA8FD2C3),
      helpstring("ISpeechResourceLoader Interface"),
      dual,
      oleautomation
    ]
    interface ISpeechResourceLoader : IDispatch {
        [id(0x00000001)]
        HRESULT LoadResource(
                        [in] BSTR bstrResourceUri, 
                        [in] VARIANT_BOOL fAlwaysReload, 
                        [out] IUnknown** pStream, 
                        [out] BSTR* pbstrMIMEType, 
                        [out] VARIANT_BOOL* pfModified, 
                        [out] BSTR* pbstrRedirectUrl);
        [id(0x00000002)]
        HRESULT GetLocalCopy(
                        [in] BSTR bstrResourceUri, 
                        [out] BSTR* pbstrLocalPath, 
                        [out] BSTR* pbstrMIMEType, 
                        [out] BSTR* pbstrRedirectUrl);
        [id(0x00000003)]
        HRESULT ReleaseLocalCopy([in] BSTR pbstrLocalPath);
    };

    [
      odl,
      uuid(79EAC9EE-BAF9-11CE-8C82-00AA004BA90B),
      helpstring("IInternetSecurityManager Interface")
    ]
    interface IInternetSecurityManager : IUnknown {
        HRESULT _stdcall SetSecuritySite([in] IInternetSecurityMgrSite* pSite);
        HRESULT _stdcall GetSecuritySite([out] IInternetSecurityMgrSite** ppSite);
        HRESULT _stdcall MapUrlToZone(
                        [in] LPWSTR pwszUrl, 
                        [out] unsigned long* pdwZone, 
                        [in] unsigned long dwFlags);
        HRESULT _stdcall GetSecurityId(
                        [in] LPWSTR pwszUrl, 
                        [out] unsigned char* pbSecurityId, 
                        [in, out] unsigned long* pcbSecurityId, 
                        [in] ULONG_PTR dwReserved);
        HRESULT _stdcall ProcessUrlAction(
                        [in] LPWSTR pwszUrl, 
                        [in] unsigned long dwAction, 
                        [out] unsigned char* pPolicy, 
                        [in] unsigned long cbPolicy, 
                        [in] unsigned char* pContext, 
                        [in] unsigned long cbContext, 
                        [in] unsigned long dwFlags, 
                        [in] unsigned long dwReserved);
        HRESULT _stdcall QueryCustomPolicy(
                        [in] LPWSTR pwszUrl, 
                        [in] GUID* guidKey, 
                        [out] unsigned char** ppPolicy, 
                        [out] unsigned long* pcbPolicy, 
                        [in] unsigned char* pContext, 
                        [in] unsigned long cbContext, 
                        [in] unsigned long dwReserved);
        HRESULT _stdcall SetZoneMapping(
                        [in] unsigned long dwZone, 
                        [in] LPWSTR lpszPattern, 
                        [in] unsigned long dwFlags);
        HRESULT _stdcall GetZoneMappings(
                        [in] unsigned long dwZone, 
                        [out] IEnumString** ppenumString, 
                        [in] unsigned long dwFlags);
    };

    [
      odl,
      uuid(79EAC9ED-BAF9-11CE-8C82-00AA004BA90B),
      helpstring("IInternetSecurityMgrSite Interface")
    ]
    interface IInternetSecurityMgrSite : IUnknown {
        HRESULT _stdcall GetWindow([out] wireHWND* phwnd);
        HRESULT _stdcall EnableModeless([in] long fEnable);
    };

    typedef [public    ,
      custom(F914481D-9C62-4B43-9340-E9B2E6252E5F, 1)    
]
    uint64 ULONG_PTR;

    [
      odl,
      uuid(00000101-0000-0000-C000-000000000046)
    ]
    interface IEnumString : IUnknown {
        HRESULT _stdcall RemoteNext(
                        [in] unsigned long celt, 
                        [out] LPWSTR* rgelt, 
                        [out] unsigned long* pceltFetched);
        HRESULT _stdcall Skip([in] unsigned long celt);
        HRESULT _stdcall Reset();
        HRESULT _stdcall Clone([out] IEnumString** ppEnum);
    };
};


XML转数组Object 序列化和反序列化 AutoHotkey 2406

作者为 发表

Autohotkey

引用:[AHK_L] Save/Load Arrays

;示例
str =
(
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>
)
xml_root_node := XA_LoadStr(str) ;从字符串加载xml 从文件用XA_Load(Path)
xml_obj := %xml_root_node% ;数组对象变量名是返回的根节点
MsgBox % xml_obj.to "`n" "<?xml version=""1.0"" encoding=""UTF-8""?>`n<" xml_root_node ">`n" . XA_ArrayToXML(xml_obj) . "`n</" xml_root_node ">"



XA_Save(Array, Path) {
FileDelete, % Path
FileAppend, % "<?xml version=""1.0"" encoding=""UTF-8""?>`n<" . Array . ">`n" . XA_ArrayToXML(Array) . "`n</" . Array . ">", % Path, UTF-8
If (ErrorLevel)
	Return 1
Return 0
}
XA_LoadStr(XMLText) {
  Local XMLObj, XMLRoot, Root1, Root2
  XMLObj    := XA_LoadXML(XMLText)
  XMLObj    := XMLObj.selectSingleNode("/*")
  XMLRoot   := XMLObj.nodeName
  %XMLRoot% := XA_XMLToArray(XMLObj.childNodes)

  Return XMLRoot
}

XA_Load(Path) {
  Local XMLText, XMLObj, XMLRoot, Root1, Root2

  If (!FileExist(Path))
	Return 1

  FileRead, XMLText, % Path

  XMLObj    := XA_LoadXML(XMLText)
  XMLObj    := XMLObj.selectSingleNode("/*")
  XMLRoot   := XMLObj.nodeName
  %XMLRoot% := XA_XMLToArray(XMLObj.childNodes)

  Return XMLRoot
}
XA_XMLToArray(nodes, NodeName="") {
   Obj := Object()

   for node in nodes
   {
      if (node.nodeName != "#text")  ;NAME
	  {
		If (node.nodeName == "Invalid_Name" && node.getAttribute("ahk") == "True")
		  NodeName := node.getAttribute("id")
		Else
		  NodeName := node.nodeName
	  }

      else ;VALUE
		  Obj := node.nodeValue

      if node.hasChildNodes
	  {
		;Same node name was used for multiple nodes
		If ((node.nextSibling.nodeName = node.nodeName || node.nodeName = node.previousSibling.nodeName) && node.nodeName != "Invalid_Name" && node.getAttribute("ahk") != "True")
		{
		  ;Create object
		  If (!node.previousSibling.nodeName)
		  {
			Obj[NodeName] := Object()
			ItemCount := 0
		  }

		  ItemCount++

		  ;Use the supplied ID if available
		  If (node.getAttribute("id") != "")
		    Obj[NodeName][node.getAttribute("id")] := XA_XMLToArray(node.childNodes, node.getAttribute("id"))

		  ;Use ItemCount if no ID was provided
		  Else
			Obj[NodeName][ItemCount] := XA_XMLToArray(node.childNodes, ItemCount)
	    }

		Else
		  Obj.Insert(NodeName, XA_XMLToArray(node.childNodes, NodeName))
	  }
   }

   return Obj
}
XA_LoadXML(ByRef data){
   o := ComObjCreate("MSXML2.DOMDocument.6.0")
   o.async := false
   o.LoadXML(data)
   return o
}
XA_ArrayToXML(theArray, tabCount=1, NodeName="") {
    Local tabSpace, extraTabSpace, tag, val, theXML, root
	tabCount++
    tabSpace := ""
    extraTabSpace := ""

	if (!IsObject(theArray)) {
	  root := theArray
	  theArray := %theArray%
    }

	While (A_Index < tabCount) {
        tabSpace .= "`t"
		extraTabSpace := tabSpace . "`t"
    }

	for tag, val in theArray {
        If (!IsObject(val))
		{
		  If (XA_InvalidTag(tag))
		    theXML .= "`n" . tabSpace . "<Invalid_Name id=""" . XA_XMLEncode(tag) . """ ahk=""True"">" . XA_XMLEncode(val) . "</Invalid_Name>"
		  Else
			theXML .= "`n" . tabSpace . "<" . tag . ">" . XA_XMLEncode(val) . "</" . tag . ">"
	    }

		Else
		{
		  If (XA_InvalidTag(tag))
		    theXML .= "`n" . tabSpace . "<Invalid_Name id=""" . XA_XMLEncode(tag) . """ ahk=""True"">" . "`n" . XA_ArrayToXML(val, tabCount, "") . "`n" . tabSpace . "</Invalid_Name>"
		  Else
		    theXML .= "`n" . tabSpace . "<" . tag . ">" . "`n" . XA_ArrayToXML(val, tabCount, "") . "`n" . tabSpace . "</" . tag . ">"
	    }
    }

	theXML := SubStr(theXML, 2)
	Return theXML
}
XA_InvalidTag(Tag) {
	Char1      := SubStr(Tag, 1, 1)
	Chars3     := SubStr(Tag, 1, 3)
	StartChars := "~``!@#$%^&*()_-+={[}]|\:;""'<,>.?/1234567890 	`n`r"
	Chars := """'<>=/ 	`n`r"

	Loop, Parse, StartChars
	{
		If (Char1 = A_LoopField)
		  Return 1
	}

	Loop, Parse, Chars
	{
		If (InStr(Tag, A_LoopField))
		  Return 1
	}

	If (Chars3 = "xml")
	  Return 1

	Return 0
}
XA_XMLEncode(Text) {
StringReplace, Text, Text, &, &, All
StringReplace, Text, Text, <, <, All
StringReplace, Text, Text, >, >, All
StringReplace, Text, Text, ", ", All
StringReplace, Text, Text, ', ', All
Return Text
}


首先项目按照用C#创建COM组件全过程等方法创建c#的类库项目,本项目需要引用System.Runtime.Serialization。

using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.IO;

namespace NBFS
{

    [Guid("154BD6A6-5AB8-4d7d-A343-0A68AB79470B")]

    public interface NBFS_Interface
    {

        [DispId(1)]
        string DecodeBinaryXML(byte[] encodedXML);

        [DispId(2)]
        byte[] EncodeBinaryXML(string xml);

    }



    [Guid("D11FEA37-AC57-4d39-9522-E49C4F9826BB"),

    InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface NBFS_Events
    {



    }



    [Guid("2E3C7BAD-1051-4622-9C4C-215182C6BF58"),

      ClassInterface(ClassInterfaceType.None),
      ProgId("NBFS.BINXML"),
      ComSourceInterfaces(typeof(NBFS_Events))]

    public class BINXML : NBFS_Interface
    {
        private WcfBinaryCodec m_wcfBinaryCodec = new WcfBinaryCodec(Encoding.UTF8);

        public BINXML() { }

        public string DecodeBinaryXML(byte[] encodedXML)
        {
            if (encodedXML == null)
            {
                return "";
            }
            return m_wcfBinaryCodec.DecodeBinaryXML(encodedXML, false);
        }

        public byte[] EncodeBinaryXML(string xml)
        {
            if (String.IsNullOrEmpty(xml.Trim()))
            {
                return null;
            }
            return m_wcfBinaryCodec.EncodeBinaryXML(xml);
        }

    }




    public class WcfBinaryCodec
    {
        public WcfBinaryCodec()
        { }

        public WcfBinaryCodec(Encoding encoding)
        {
            m_encoding = encoding;
        }

        Encoding m_encoding = Encoding.UTF8;

        /// <summary>
        /// Decode a bytestream that was encoded by WCF's BinaryEncodingBindingElement.  Will throw if the bytestream does
        /// not decode properly or the result is not valid XML.  I/O streams are flushed but not closed.
        /// </summary>        
        /// <param name="explodeNewlines">if true, the returned string will be nicely indented according to 
        /// element depth, and each attribute will be placed on its own line</param>
        /// <returns></returns>
        public void DecodeBinaryXML(Stream binaryInput, Stream xmlOutput, bool? explodeNewlines)
        {
            // defaults
            var explode = explodeNewlines ?? false;

            // parse bytestream into the XML DOM
            var doc = new XmlDocument();
            using (var binaryReader = XmlDictionaryReader.CreateBinaryReader(binaryInput, WcfDictionaryBuilder.Dict, XmlDictionaryReaderQuotas.Max))
            {
                doc.Load(binaryReader);
            }

            // write document to the output stream with customized settings
            var settings = new XmlWriterSettings()
            {
                CheckCharacters = false,
                CloseOutput = false,
                ConformanceLevel = ConformanceLevel.Auto,
                Encoding = m_encoding,
                Indent = explode,
                IndentChars = "\t",
                NewLineChars = Environment.NewLine,
                NewLineHandling = explode ? NewLineHandling.Replace : NewLineHandling.None,
                NewLineOnAttributes = explode
            };
            using (var writer = XmlWriter.Create(xmlOutput, settings))
            {
                doc.Save(writer);
                writer.Flush();
                xmlOutput.Flush();
            }
        }

        public string DecodeBinaryXML(byte[] binaryInput, bool? explodeNewLines)
        {
            var input = new MemoryStream(binaryInput);
            var output = new MemoryStream();
            DecodeBinaryXML(input, output, explodeNewLines);
            output.Seek(0, SeekOrigin.Begin);
            return new StreamReader(output, m_encoding).ReadToEnd();
        }

        /// <summary>
        /// Encode a text stream into a binary XML stream compatible with WCF's BinaryEncodingBindingElement.  Will throw if 
        /// the input stream cannot be parsed into an XML document.  I/O streams are flushed but not closed.
        /// </summary>
        /// <param name="xmlInput"></param>
        /// <param name="binaryOutput"></param>
        public void EncodeBinaryXML(Stream xmlInput, Stream binaryOutput)
        {
            // parse string into the XML DOM
            var doc = new XmlDocument();
            doc.Load(xmlInput);

            // write bytestream
            using (var binaryWriter = XmlDictionaryWriter.CreateBinaryWriter(binaryOutput, WcfDictionaryBuilder.Dict, null, false))
            {
                doc.Save(binaryWriter);
                binaryWriter.Flush();
                binaryOutput.Flush();
            }
        }

        public byte[] EncodeBinaryXML(string xmlInput)
        {
            var input = new MemoryStream(m_encoding.GetBytes(xmlInput));
            var output = new MemoryStream();
            EncodeBinaryXML(input, output);
            return output.ToArray();
        }
    }

    public static class WcfDictionaryBuilder
    {
        private static XmlDictionary dict;

        public static XmlDictionary Dict
        {
            get { return dict; }
        }

        static WcfDictionaryBuilder()
        {
            dict = new XmlDictionary();
            dict.Add("mustUnderstand");
            dict.Add("Envelope");
            dict.Add("http://www.w3.org/2003/05/soap-envelope");
            dict.Add("http://www.w3.org/2005/08/addressing");
            dict.Add("Header");
            dict.Add("Action");
            dict.Add("To");
            dict.Add("Body");
            dict.Add("Algorithm");
            dict.Add("RelatesTo");
            dict.Add("http://www.w3.org/2005/08/addressing/anonymous");
            dict.Add("URI");
            dict.Add("Reference");
            dict.Add("MessageID");
            dict.Add("Id");
            dict.Add("Identifier");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm");
            dict.Add("Transforms");
            dict.Add("Transform");
            dict.Add("DigestMethod");
            dict.Add("Address");
            dict.Add("ReplyTo");
            dict.Add("SequenceAcknowledgement");
            dict.Add("AcknowledgementRange");
            dict.Add("Upper");
            dict.Add("Lower");
            dict.Add("BufferRemaining");
            dict.Add("http://schemas.microsoft.com/ws/2006/05/rm");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement");
            dict.Add("SecurityTokenReference");
            dict.Add("Sequence");
            dict.Add("MessageNumber");
            dict.Add("http://www.w3.org/2000/09/xmldsig#");
            dict.Add("http://www.w3.org/2000/09/xmldsig#enveloped-signature");
            dict.Add("KeyInfo");
            dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
            dict.Add("http://www.w3.org/2001/04/xmlenc#");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/sc");
            dict.Add("DerivedKeyToken");
            dict.Add("Nonce");
            dict.Add("Signature");
            dict.Add("SignedInfo");
            dict.Add("CanonicalizationMethod");
            dict.Add("SignatureMethod");
            dict.Add("SignatureValue");
            dict.Add("DataReference");
            dict.Add("EncryptedData");
            dict.Add("EncryptionMethod");
            dict.Add("CipherData");
            dict.Add("CipherValue");
            dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
            dict.Add("Security");
            dict.Add("Timestamp");
            dict.Add("Created");
            dict.Add("Expires");
            dict.Add("Length");
            dict.Add("ReferenceList");
            dict.Add("ValueType");
            dict.Add("Type");
            dict.Add("EncryptedHeader");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd");
            dict.Add("RequestSecurityTokenResponseCollection");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust#BinarySecret");
            dict.Add("http://schemas.microsoft.com/ws/2006/02/transactions");
            dict.Add("s");
            dict.Add("Fault");
            dict.Add("MustUnderstand");
            dict.Add("role");
            dict.Add("relay");
            dict.Add("Code");
            dict.Add("Reason");
            dict.Add("Text");
            dict.Add("Node");
            dict.Add("Role");
            dict.Add("Detail");
            dict.Add("Value");
            dict.Add("Subcode");
            dict.Add("NotUnderstood");
            dict.Add("qname");
            dict.Add("");
            dict.Add("From");
            dict.Add("FaultTo");
            dict.Add("EndpointReference");
            dict.Add("PortType");
            dict.Add("ServiceName");
            dict.Add("PortName");
            dict.Add("ReferenceProperties");
            dict.Add("RelationshipType");
            dict.Add("Reply");
            dict.Add("a");
            dict.Add("http://schemas.xmlsoap.org/ws/2006/02/addressingidentity");
            dict.Add("Identity");
            dict.Add("Spn");
            dict.Add("Upn");
            dict.Add("Rsa");
            dict.Add("Dns");
            dict.Add("X509v3Certificate");
            dict.Add("http://www.w3.org/2005/08/addressing/fault");
            dict.Add("ReferenceParameters");
            dict.Add("IsReferenceParameter");
            dict.Add("http://www.w3.org/2005/08/addressing/reply");
            dict.Add("http://www.w3.org/2005/08/addressing/none");
            dict.Add("Metadata");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/08/addressing");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/06/addressingex");
            dict.Add("RedirectTo");
            dict.Add("Via");
            dict.Add("http://www.w3.org/2001/10/xml-exc-c14n#");
            dict.Add("PrefixList");
            dict.Add("InclusiveNamespaces");
            dict.Add("ec");
            dict.Add("SecurityContextToken");
            dict.Add("Generation");
            dict.Add("Label");
            dict.Add("Offset");
            dict.Add("Properties");
            dict.Add("Cookie");
            dict.Add("wsc");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/sc");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/sc/dk");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/sc/sct");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/RST/SCT");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/RSTR/SCT");
            dict.Add("RenewNeeded");
            dict.Add("BadContextToken");
            dict.Add("c");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/sc/dk");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/sc/sct");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT/Renew");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT/Renew");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT/Cancel");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT/Cancel");
            dict.Add("http://www.w3.org/2001/04/xmlenc#aes128-cbc");
            dict.Add("http://www.w3.org/2001/04/xmlenc#kw-aes128");
            dict.Add("http://www.w3.org/2001/04/xmlenc#aes192-cbc");
            dict.Add("http://www.w3.org/2001/04/xmlenc#kw-aes192");
            dict.Add("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
            dict.Add("http://www.w3.org/2001/04/xmlenc#kw-aes256");
            dict.Add("http://www.w3.org/2001/04/xmlenc#des-cbc");
            dict.Add("http://www.w3.org/2000/09/xmldsig#dsa-sha1");
            dict.Add("http://www.w3.org/2001/10/xml-exc-c14n#WithComments");
            dict.Add("http://www.w3.org/2000/09/xmldsig#hmac-sha1");
            dict.Add("http://www.w3.org/2001/04/xmldsig-more#hmac-sha256");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1");
            dict.Add("http://www.w3.org/2001/04/xmlenc#ripemd160");
            dict.Add("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
            dict.Add("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
            dict.Add("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
            dict.Add("http://www.w3.org/2001/04/xmlenc#rsa-1_5");
            dict.Add("http://www.w3.org/2000/09/xmldsig#sha1");
            dict.Add("http://www.w3.org/2001/04/xmlenc#sha256");
            dict.Add("http://www.w3.org/2001/04/xmlenc#sha512");
            dict.Add("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
            dict.Add("http://www.w3.org/2001/04/xmlenc#kw-tripledes");
            dict.Add("http://schemas.xmlsoap.org/2005/02/trust/tlsnego#TLS_Wrap");
            dict.Add("http://schemas.xmlsoap.org/2005/02/trust/spnego#GSS_Wrap");
            dict.Add("http://schemas.microsoft.com/ws/2006/05/security");
            dict.Add("dnse");
            dict.Add("o");
            dict.Add("Password");
            dict.Add("PasswordText");
            dict.Add("Username");
            dict.Add("UsernameToken");
            dict.Add("BinarySecurityToken");
            dict.Add("EncodingType");
            dict.Add("KeyIdentifier");
            dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary");
            dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#HexBinary");
            dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Text");
            dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#GSS_Kerberosv5_AP_REQ");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#GSS_Kerberosv5_AP_REQ1510");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0#SAMLAssertionID");
            dict.Add("Assertion");
            dict.Add("urn:oasis:names:tc:SAML:1.0:assertion");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-rel-token-profile-1.0.pdf#license");
            dict.Add("FailedAuthentication");
            dict.Add("InvalidSecurityToken");
            dict.Add("InvalidSecurity");
            dict.Add("k");
            dict.Add("SignatureConfirmation");
            dict.Add("TokenType");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#ThumbprintSHA1");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKeySHA1");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLID");
            dict.Add("AUTH-HASH");
            dict.Add("RequestSecurityTokenResponse");
            dict.Add("KeySize");
            dict.Add("RequestedTokenReference");
            dict.Add("AppliesTo");
            dict.Add("Authenticator");
            dict.Add("CombinedHash");
            dict.Add("BinaryExchange");
            dict.Add("Lifetime");
            dict.Add("RequestedSecurityToken");
            dict.Add("Entropy");
            dict.Add("RequestedProofToken");
            dict.Add("ComputedKey");
            dict.Add("RequestSecurityToken");
            dict.Add("RequestType");
            dict.Add("Context");
            dict.Add("BinarySecret");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/spnego");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/tlsnego");
            dict.Add("wst");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/trust");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/RST/Issue");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/RSTR/Issue");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/CK/PSHA1");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/SymmetricKey");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/Nonce");
            dict.Add("KeyType");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/trust/SymmetricKey");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/04/trust/PublicKey");
            dict.Add("Claims");
            dict.Add("InvalidRequest");
            dict.Add("RequestFailed");
            dict.Add("SignWith");
            dict.Add("EncryptWith");
            dict.Add("EncryptionAlgorithm");
            dict.Add("CanonicalizationAlgorithm");
            dict.Add("ComputedKeyAlgorithm");
            dict.Add("UseKey");
            dict.Add("http://schemas.microsoft.com/net/2004/07/secext/WS-SPNego");
            dict.Add("http://schemas.microsoft.com/net/2004/07/secext/TLSNego");
            dict.Add("t");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Issue");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/CK/PSHA1");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Nonce");
            dict.Add("RenewTarget");
            dict.Add("CancelTarget");
            dict.Add("RequestedTokenCancelled");
            dict.Add("RequestedAttachedReference");
            dict.Add("RequestedUnattachedReference");
            dict.Add("IssuedTokens");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Renew");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Cancel");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/PublicKey");
            dict.Add("Access");
            dict.Add("AccessDecision");
            dict.Add("Advice");
            dict.Add("AssertionID");
            dict.Add("AssertionIDReference");
            dict.Add("Attribute");
            dict.Add("AttributeName");
            dict.Add("AttributeNamespace");
            dict.Add("AttributeStatement");
            dict.Add("AttributeValue");
            dict.Add("Audience");
            dict.Add("AudienceRestrictionCondition");
            dict.Add("AuthenticationInstant");
            dict.Add("AuthenticationMethod");
            dict.Add("AuthenticationStatement");
            dict.Add("AuthorityBinding");
            dict.Add("AuthorityKind");
            dict.Add("AuthorizationDecisionStatement");
            dict.Add("Binding");
            dict.Add("Condition");
            dict.Add("Conditions");
            dict.Add("Decision");
            dict.Add("DoNotCacheCondition");
            dict.Add("Evidence");
            dict.Add("IssueInstant");
            dict.Add("Issuer");
            dict.Add("Location");
            dict.Add("MajorVersion");
            dict.Add("MinorVersion");
            dict.Add("NameIdentifier");
            dict.Add("Format");
            dict.Add("NameQualifier");
            dict.Add("Namespace");
            dict.Add("NotBefore");
            dict.Add("NotOnOrAfter");
            dict.Add("saml");
            dict.Add("Statement");
            dict.Add("Subject");
            dict.Add("SubjectConfirmation");
            dict.Add("SubjectConfirmationData");
            dict.Add("ConfirmationMethod");
            dict.Add("urn:oasis:names:tc:SAML:1.0:cm:holder-of-key");
            dict.Add("urn:oasis:names:tc:SAML:1.0:cm:sender-vouches");
            dict.Add("SubjectLocality");
            dict.Add("DNSAddress");
            dict.Add("IPAddress");
            dict.Add("SubjectStatement");
            dict.Add("urn:oasis:names:tc:SAML:1.0:am:unspecified");
            dict.Add("xmlns");
            dict.Add("Resource");
            dict.Add("UserName");
            dict.Add("urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName");
            dict.Add("EmailName");
            dict.Add("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress");
            dict.Add("u");
            dict.Add("ChannelInstance");
            dict.Add("http://schemas.microsoft.com/ws/2005/02/duplex");
            dict.Add("Encoding");
            dict.Add("MimeType");
            dict.Add("CarriedKeyName");
            dict.Add("Recipient");
            dict.Add("EncryptedKey");
            dict.Add("KeyReference");
            dict.Add("e");
            dict.Add("http://www.w3.org/2001/04/xmlenc#Element");
            dict.Add("http://www.w3.org/2001/04/xmlenc#Content");
            dict.Add("KeyName");
            dict.Add("MgmtData");
            dict.Add("KeyValue");
            dict.Add("RSAKeyValue");
            dict.Add("Modulus");
            dict.Add("Exponent");
            dict.Add("X509Data");
            dict.Add("X509IssuerSerial");
            dict.Add("X509IssuerName");
            dict.Add("X509SerialNumber");
            dict.Add("X509Certificate");
            dict.Add("AckRequested");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/AckRequested");
            dict.Add("AcksTo");
            dict.Add("Accept");
            dict.Add("CreateSequence");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence");
            dict.Add("CreateSequenceRefused");
            dict.Add("CreateSequenceResponse");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse");
            dict.Add("FaultCode");
            dict.Add("InvalidAcknowledgement");
            dict.Add("LastMessage");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage");
            dict.Add("LastMessageNumberExceeded");
            dict.Add("MessageNumberRollover");
            dict.Add("Nack");
            dict.Add("netrm");
            dict.Add("Offer");
            dict.Add("r");
            dict.Add("SequenceFault");
            dict.Add("SequenceTerminated");
            dict.Add("TerminateSequence");
            dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence");
            dict.Add("UnknownSequence");
            dict.Add("http://schemas.microsoft.com/ws/2006/02/tx/oletx");
            dict.Add("oletx");
            dict.Add("OleTxTransaction");
            dict.Add("PropagationToken");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor");
            dict.Add("wscoor");
            dict.Add("CreateCoordinationContext");
            dict.Add("CreateCoordinationContextResponse");
            dict.Add("CoordinationContext");
            dict.Add("CurrentContext");
            dict.Add("CoordinationType");
            dict.Add("RegistrationService");
            dict.Add("Register");
            dict.Add("RegisterResponse");
            dict.Add("ProtocolIdentifier");
            dict.Add("CoordinatorProtocolService");
            dict.Add("ParticipantProtocolService");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContext");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContextResponse");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/Register");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/RegisterResponse");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/fault");
            dict.Add("ActivationCoordinatorPortType");
            dict.Add("RegistrationCoordinatorPortType");
            dict.Add("InvalidState");
            dict.Add("InvalidProtocol");
            dict.Add("InvalidParameters");
            dict.Add("NoActivity");
            dict.Add("ContextRefused");
            dict.Add("AlreadyRegistered");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat");
            dict.Add("wsat");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Durable2PC");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Volatile2PC");
            dict.Add("Prepare");
            dict.Add("Prepared");
            dict.Add("ReadOnly");
            dict.Add("Commit");
            dict.Add("Rollback");
            dict.Add("Committed");
            dict.Add("Aborted");
            dict.Add("Replay");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Commit");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Rollback");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Committed");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Aborted");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Prepare");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Prepared");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/ReadOnly");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Replay");
            dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/fault");
            dict.Add("CompletionCoordinatorPortType");
            dict.Add("CompletionParticipantPortType");
            dict.Add("CoordinatorPortType");
            dict.Add("ParticipantPortType");
            dict.Add("InconsistentInternalState");
            dict.Add("mstx");
            dict.Add("Enlistment");
            dict.Add("protocol");
            dict.Add("LocalTransactionId");
            dict.Add("IsolationLevel");
            dict.Add("IsolationFlags");
            dict.Add("Description");
            dict.Add("Loopback");
            dict.Add("RegisterInfo");
            dict.Add("ContextId");
            dict.Add("TokenId");
            dict.Add("AccessDenied");
            dict.Add("InvalidPolicy");
            dict.Add("CoordinatorRegistrationFailed");
            dict.Add("TooManyEnlistments");
            dict.Add("Disabled");
            dict.Add("ActivityId");
            dict.Add("http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics");
            dict.Add("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#Kerberosv5APREQSHA1");
            dict.Add("http://schemas.xmlsoap.org/ws/2002/12/policy");
            dict.Add("FloodMessage");
            dict.Add("LinkUtility");
            dict.Add("Hops");
            dict.Add("http://schemas.microsoft.com/net/2006/05/peer/HopCount");
            dict.Add("PeerVia");
            dict.Add("http://schemas.microsoft.com/net/2006/05/peer");
            dict.Add("PeerFlooder");
            dict.Add("PeerTo");
            dict.Add("http://schemas.microsoft.com/ws/2005/05/routing");
            dict.Add("PacketRoutable");
            dict.Add("http://schemas.microsoft.com/ws/2005/05/addressing/none");
            dict.Add("http://schemas.microsoft.com/ws/2005/05/envelope/none");
            dict.Add("http://www.w3.org/2001/XMLSchema-instance");
            dict.Add("http://www.w3.org/2001/XMLSchema");
            dict.Add("nil");
            dict.Add("type");
            dict.Add("char");
            dict.Add("boolean");
            dict.Add("byte");
            dict.Add("unsignedByte");
            dict.Add("short");
            dict.Add("unsignedShort");
            dict.Add("int");
            dict.Add("unsignedInt");
            dict.Add("long");
            dict.Add("unsignedLong");
            dict.Add("float");
            dict.Add("double");
            dict.Add("decimal");
            dict.Add("dateTime");
            dict.Add("string");
            dict.Add("base64Binary");
            dict.Add("anyType");
            dict.Add("duration");
            dict.Add("guid");
            dict.Add("anyURI");
            dict.Add("QName");
            dict.Add("time");
            dict.Add("date");
            dict.Add("hexBinary");
            dict.Add("gYearMonth");
            dict.Add("gYear");
            dict.Add("gMonthDay");
            dict.Add("gDay");
            dict.Add("gMonth");
            dict.Add("integer");
            dict.Add("positiveInteger");
            dict.Add("negativeInteger");
            dict.Add("nonPositiveInteger");
            dict.Add("nonNegativeInteger");
            dict.Add("normalizedString");
            dict.Add("ConnectionLimitReached");
            dict.Add("http://schemas.xmlsoap.org/soap/envelope/");
            dict.Add("Actor");
            dict.Add("Faultcode");
            dict.Add("Faultstring");
            dict.Add("Faultactor");
            dict.Add("Detail");
        }
    }

}

然后生成解决方案,找到.net的命令行,用regasm.exe /codebase xxxxx.dll的方式注册com控件,就可以用其他语言调用了。


下面是ahk的使用示例:

;string DecodeBinaryXML(array encodedXML)
;array EncodeBinaryXML(string xml)
binarray := BinArr_FromFile("二进制.txt") ;从文件读取字节流
str := mycom.DecodeBinaryXML(binarray) ;转换成明文
binarray2 := mycom.EncodeBinaryXML(str) ;再编码回二进制
BinArr_ToFile(binarray2, "二进制2.txt")

MsgBox % str


 BinArr_FromString(str) {
	oADO := ComObjCreate("ADODB.Stream")

	oADO.Type := 2 ; adTypeText
	oADO.Mode := 3 ; adModeReadWrite
	oADO.Open
	oADO.Charset := "UTF-8"
	oADO.WriteText(str)

	oADO.Position := 0
	oADO.Type := 1 ; adTypeBinary
	oADO.Position := 3 ; Skip UTF-8 BOM
	return oADO.Read, oADO.Close
}

BinArr_FromFile(FileName) {
	oADO := ComObjCreate("ADODB.Stream")

	oADO.Type := 1 ; adTypeBinary
	oADO.Open
	oADO.LoadFromFile(FileName)
	return oADO.Read, oADO.Close
}

BinArr_Join(Arrays*) {
	oADO := ComObjCreate("ADODB.Stream")

	oADO.Type := 1 ; adTypeBinary
	oADO.Mode := 3 ; adModeReadWrite
	oADO.Open
	For i, arr in Arrays
		oADO.Write(arr)
	oADO.Position := 0
	return oADO.Read, oADO.Close
}

BinArr_ToString(BinArr, Encoding := "UTF-8") {
	oADO := ComObjCreate("ADODB.Stream")

	oADO.Type := 1 ; adTypeBinary
	oADO.Mode := 3 ; adModeReadWrite
	oADO.Open
	oADO.Write(BinArr)

	oADO.Position := 0
	oADO.Type := 2 ; adTypeText
	oADO.Charset  := Encoding
	return oADO.ReadText, oADO.Close
}

BinArr_ToFile(BinArr, FileName) {
	oADO := ComObjCreate("ADODB.Stream")

	oADO.Type := 1 ; adTypeBinary
	oADO.Open
	oADO.Write(BinArr)
	oADO.SaveToFile(FileName, 2)
	oADO.Close
}


C#源码下载

2016年7月25日直播Autohotkey GUI部分视频 4939

作者为 发表

AHK直播录播

去年录的GUI部分的直播教程,抛砖引玉。当时念的单词parse,人懒就不后期修改了,见谅。

IE添加受信站点 Autohotkey 2384

作者为 发表

Autohotkey

i := 0
Loop, Reg, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges, K
{
	ti := RegExReplace(A_LoopRegName,"Range","")
	if (ti>i)
		i := ti
}
list =
(
192.168.9.1
192.168.9.2
192.168.9.3
192.168.9.4
192.168.9.5
)
Loop, Parse, list, `n, `r
{
	if A_LoopField
	{
		i++
		RegWrite, REG_SZ, HKCU, % "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range" i, :Range, % A_LoopField
		RegWrite, REG_DWORD, HKCU, % "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range" i, http, 0x2
	}
}



友情链接:Autohotkey中文帮助Autohotkey官网Autohotkey中文网联系作者免GooglePlay APK下载

 主题设计 • skyfrit.com  Thinkai's Blog | 保留所有权利

50 queries in 1.586 seconds |