using System; using System.Runtime.InteropServices; using Vanara.Collections; using LPARAM = System.IntPtr; using WPARAM = System.IntPtr; namespace Vanara.PInvoke { public static partial class MSCTF { /// Specifies the actual confidence for this element. [PInvokeData("sapi.h")] public enum SP_CONFIDENCE { /// The speech engine has low confidence in the element. SP_LOW_CONFIDENCE = -1, /// The speech engine has normal confidence in the element. SP_NORMAL_CONFIDENCE = 0, /// The speech engine has high confidence in the element. SP_HIGH_CONFIDENCE = 1 } /// The property UI status. [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnPropertyUIStatus")] public enum TF_PROPUI_STATUS { /// The property can be serialized. If this value is not present, the property cannot be serialized. TF_PROPUI_STATUS_SAVETOFILE = 1 } /// /// Elements of the TfCandidateResult enumeration are used with the ITfCandidateList::SetResult method to specify the result /// of a reconversion operation performed on a given candidate string. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/ne-ctffunc-tfcandidateresult [PInvokeData("ctffunc.h", MSDNShortId = "NE:ctffunc.__MIDL_ITfCandidateList_0001")] [Guid("BAA898F2-0207-4643-92CA-F3F7B0CF6F80")] public enum TfCandidateResult : uint { /// /// The candidate string has been selected and accepted. The previous text should be replaced with the specified candidate. /// CAND_FINALIZED, /// The candidate string has been selected, but the selection is not yet final. CAND_SELECTED, /// The reconversion operation has been canceled. CAND_CANCELED, } /// /// Elements of the TfIntegratableCandidateListSelectionStyle enumeration specify the integratable candidate list selection styles. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/ne-ctffunc-tfintegratablecandidatelistselectionstyle [PInvokeData("ctffunc.h", MSDNShortId = "NE:ctffunc.__MIDL___MIDL_itf_ctffunc_0000_0022_0001")] [Guid("AF8F5D86-0615-4af3-90FA-5DCBB407A5D4")] public enum TfIntegratableCandidateListSelectionStyle : uint { /// The selection can be changed with the arrow keys. STYLE_ACTIVE_SELECTION, /// The default selection key will choose the selection. STYLE_IMPLIED_SELECTION, } /// /// Elements of the TfSapiObject enumeration are used with the ITfFnGetSAPIObject::Get method to specify a specific type of /// Speech API (SAPI) object. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/ne-ctffunc-tfsapiobject [PInvokeData("ctffunc.h", MSDNShortId = "NE:ctffunc.__MIDL___MIDL_itf_ctffunc_0000_0011_0001")] [Guid("36ADB6D9-DA1F-45D8-A499-86167E0F936B")] public enum TfSapiObject : uint { /// Specifies an ISpResourceManager object. GETIF_RESMGR, /// Specifies an ISpRecoContext object. GETIF_RECOCONTEXT, /// Specifies an ISpRecognizer object. GETIF_RECOGNIZER, /// Specifies an ISpVoice object. GETIF_VOICE, /// Specifies an ISpRecoGrammar object. GETIF_DICTGRAM, /// Specifies an ISpRecognizer object. SAPI will not be initialized if it is not already. GETIF_RECOGNIZERNOINIT, } /// /// Each identifier is specific to a certain language, and these are all specific to the touch keyboard. There is no way to request /// support for other layouts, or to add new touch optimized layouts dynamically. /// [PInvokeData("ctffunc.h")] public enum TKBLayoutId : ushort { #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member TKBLT_UNDEFINED = 0, TKBL_CLASSIC_TRADITIONAL_CHINESE_PHONETIC = 0x0404, TKBL_CLASSIC_TRADITIONAL_CHINESE_CHANGJIE = 0xF042, TKBL_CLASSIC_TRADITIONAL_CHINESE_DAYI = 0xF043, TKBL_OPT_JAPANESE_ABC = 0x0411, TKBL_OPT_KOREAN_HANGUL_2_BULSIK = 0x0412, TKBL_OPT_SIMPLIFIED_CHINESE_PINYIN = 0x0804, #pragma warning disable CA1069 // Enums values should not be duplicated TKBL_OPT_TRADITIONAL_CHINESE_PHONETIC = 0x0404, #pragma warning restore CA1069 // Enums values should not be duplicated #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } /// /// Elements of the TKBLayoutType enumeration are passed by an IME in a call to /// ITfFnGetPreferredTouchKeyboardLayout::GetLayout to specify the type of layout. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/ne-ctffunc-tkblayouttype [PInvokeData("ctffunc.h", MSDNShortId = "NE:ctffunc.__MIDL_ITfFnGetPreferredTouchKeyboardLayout_0001")] [Guid("5F309A41-590A-4ACC-A97F-D8EFFF13FDFC")] public enum TKBLayoutType : uint { /// Undefined. If specified, it will cause the layout to fallback to a classic layout. TKBLT_UNDEFINED, /// The touch keyboard is to use a classic layout. TKBLT_CLASSIC, /// The touch keyboard is to use a touch-optimized layout. TKBLT_OPTIMIZED, } /// Undocumented. /// [PInvokeData("ctffunc.h")] [ComImport, Guid("8C5DAC4F-083C-4B85-A4C9-71746048ADCA"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IEnumSpeechCommands : ICOMEnum { /// Creates a copy of the enumerator object. /// Pointer to an IEnumSpeechCommands interface pointer that receives the new enumerator. IEnumSpeechCommands Clone(); /// Obtains, from the current position, the specified number of elements in the enumeration sequence. /// Specifies the number of elements to obtain. /// /// Pointer to an array of string pointers that receives the requested objects. This array must be at least ulCount elements in size. /// /// /// Pointer to a ULONG value that receives the number of elements obtained. This value can be less than the number of items /// requested. This parameter can be NULL. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// The method reached the end of the enumeration before the specified number of elements could be obtained. /// /// /// E_INVALIDARG /// pSpCmds is invalid. /// /// /// [PreserveSig] HRESULT Next([In] uint ulCount, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr)] string[] pSpCmds, [NullAllowed] out uint pcFetched); /// Resets the enumerator object by moving the current position to the beginning of the enumeration sequence. void Reset(); /// Moves the current position forward in the enumeration sequence by the specified number of elements. /// Contains the number of elements to skip. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// The method reached the end of the enumeration before the specified number of elements could be skipped. /// /// /// [PreserveSig] HRESULT Skip([In] uint ulCount); } /// /// The IEnumTfCandidates interface is implemented by a text service and used by the TSF manager to provide an enumeration of /// candidate string objects. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-ienumtfcandidates [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.IEnumTfCandidates")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("DEFB1926-6C80-4CE8-87D4-D6B72B812BDE")] public interface IEnumTfCandidates : ICOMEnum { /// Creates a copy of the enumerator object. /// Pointer to an IEnumTfCandidates interface pointer that receives the new enumerator. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-ienumtfcandidates-clone HRESULT Clone( // IEnumTfCandidates **ppEnum ); [PreserveSig] HRESULT Clone([Out, MarshalAs(UnmanagedType.Interface)] out IEnumTfCandidates ppEnum); /// Obtains, from the current position, the specified number of elements in the enumeration sequence. /// Specifies the number of elements to obtain. /// /// Pointer to an array of ITfCandidateString interface pointers that receives the requested objects. This array must be at /// least ulCount elements in size. /// /// /// Pointer to a ULONG value that receives the number of elements obtained. This value can be less than the number of items /// requested. This parameter can be NULL. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// The method reached the end of the enumeration before the specified number of elements were obtained. /// /// /// E_INVALIDARG /// ppCand is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-ienumtfcandidates-next HRESULT Next( ULONG ulCount, // ITfCandidateString **ppCand, ULONG *pcFetched ); [PreserveSig] HRESULT Next([In] uint ulCount, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface)] ITfCandidateString[] ppCand, [NullAllowed] out uint pcFetched); /// Resets the enumerator object by moving the current position to the beginning of the enumeration sequence. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-ienumtfcandidates-reset HRESULT Reset(); [PreserveSig] HRESULT Reset(); /// Moves the current position forward in the enumeration sequence by the specified number of elements. /// Contains the number of elements to skip. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// The method reached the end of the enumeration before the specified number of elements could be skipped. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-ienumtfcandidates-skip HRESULT Skip( ULONG ulCount ); [PreserveSig] HRESULT Skip([In] uint ulCount); } /// /// The IEnumTfLatticeElements interface is implemented by the TSF manager to provide an enumeration of lattice elements. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-ienumtflatticeelements [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.IEnumTfLatticeElements")] [ComImport, Guid("56988052-47DA-4A05-911A-E3D941F17145"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IEnumTfLatticeElements : ICOMEnum { /// Creates a copy of the enumerator object. /// Pointer to an IEnumTfLatticeElements interface pointer that receives the new enumerator. // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-ienumtflatticeelements-clone HRESULT Clone( // IEnumTfLatticeElements **ppEnum ); IEnumTfLatticeElements Clone(); /// Obtains the specified number of elements in the enumeration sequence from the current position. /// Specifies the number of elements to obtain. /// /// /// Pointer to an array of TF_LMLATTELEMENT structures that receives the requested data. This array must be at least ulCount /// elements in size. /// /// /// The caller must free the bstrText member of every structure obtained using SysFreeString when it is no longer required. /// /// /// /// Pointer to a ULONG value that receives the number of elements actually obtained. This value can be less than the number of /// items requested. This parameter can be NULL. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// The method reached the end of the enumeration before the specified number of elements could be obtained. /// /// /// E_INVALIDARG /// rgsElements is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-ienumtflatticeelements-next HRESULT Next( ULONG // ulCount, TF_LMLATTELEMENT *rgsElements, ULONG *pcFetched ); [PreserveSig] HRESULT Next([In] uint ulCount, [Out] TF_LMLATTELEMENT[] rgsElements, [NullAllowed] out uint pcFetched); /// Resets the enumerator object by moving the current position to the beginning of the enumeration sequence. // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-ienumtflatticeelements-reset HRESULT Reset(); void Reset(); /// Moves the current position forward in the enumeration sequence by the specified number of elements. /// Contains the number of elements to skip. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// The method reached the end of the enumeration before the specified number of elements could be skipped. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-ienumtflatticeelements-skip HRESULT Skip( ULONG ulCount ); [PreserveSig] HRESULT Skip([In] uint ulCount); } /// Undocumented. [PInvokeData("ctffunc.h")] [ComImport, Guid("38E09D4C-586D-435A-B592-C8A86691DEC6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ISpeechCommandProvider { /// Undocumented. /// The langid. /// The pp enum. /// [PreserveSig] HRESULT EnumSpeechCommands([In] LANGID langid, [Out, MarshalAs(UnmanagedType.Interface)] out IEnumSpeechCommands ppEnum); /// Undocumented. /// The PSZ command. /// The CCH. /// The langid. /// [PreserveSig] HRESULT ProcessCommand([In, MarshalAs(UnmanagedType.LPWStr)] string pszCommand, [In] uint cch, [In] LANGID langid); } /// /// /// The ITfCandidateString interface is implemented by a text service and is used by the TSF manager or a client to obtain /// information about a candidate string object. /// /// /// The TSF manager implements this interface to provide access to this interface to other clients. This enables the TSF manager to /// function as a mediator between the client and the text service. /// /// To obtain an instance of this interface, the TSF manager or client can call ITfCandidateList::GetCandidate. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itfcandidatestring [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfCandidateString")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("581F317E-FD9D-443F-B972-ED00467C5D40")] public interface ITfCandidateString { /// Obtains the text of the candidate string object. /// /// Pointer to a BSTR value that receives the text of the candidate string object. The caller must release this memory /// using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pbstr is invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itfcandidatestring-getstring HRESULT GetString( BSTR // *pbstr ); [PreserveSig] HRESULT GetString([Out, MarshalAs(UnmanagedType.BStr)] out string pbstr); /// /// /// pnIndex /// /// /// Pointer to a ULONG value that receives the zero-based index of the candidate string object within the candidate list. /// /// /// /// Pointer to a ULONG value that receives the zero-based index of the candidate string object within the candidate list. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pnIndex is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itfcandidatestring-getindex HRESULT GetIndex( ULONG // *pnIndex ); [PreserveSig] HRESULT GetIndex(out uint pnIndex); } /// /// /// The ITfFnAdviseText interface is implemented by a text service and used by the TSF manager to supply notifications when /// the text or lattice element in a context changes. /// /// /// The manager obtains this interface from the text service by calling the text service ITfFunctionProvider::GetFunction interface /// with IID_ITfFnAdviseText. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnadvisetext [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnAdviseText")] [ComImport, Guid("3527268B-7D53-4DD9-92B7-7296AE461249"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITfFnAdviseText : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Called when the text within a context changes. /// Pointer to an ITfRange object that represents the range of text that has changed. /// Pointer to a WCHAR buffer that contains the new text for the range. /// Specifies the number of characters contained in pchText. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnadvisetext-ontextupdate HRESULT OnTextUpdate( // ITfRange *pRange, const WCHAR *pchText, LONG cch ); [PreserveSig] HRESULT OnTextUpdate([In] ITfRange pRange, [In, MarshalAs(UnmanagedType.LPWStr)] string pchText, int cch); /// Called when a lattice element within a context changes. /// Pointer to an ITfRange object that represents the range of text that changed. /// Pointer to an ITfLMLattice object that represents the new lattice element. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnadvisetext-onlatticeupdate HRESULT // OnLatticeUpdate( ITfRange *pRange, ITfLMLattice *pLattice ); [PreserveSig] HRESULT OnLatticeUpdate([In] ITfRange pRange, [In] ITfLMLattice pLattice); } /// /// /// The ITfFnBalloon interface is implemented by a text service and is used by an application or other text service to update /// the balloon item that the text service adds to the language bar. /// /// /// An application or text service obtains an instance of this interface by calling ITfThreadMgr::GetFunctionProvider with the class /// identifier of the text service and then calling ITfFunctionProvider::GetFunction with GUID_NULL and IID_ITfFnBalloon. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnballoon [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnBalloon")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("3BAB89E4-5FBE-45F4-A5BC-DCA36AD225A8")] public interface ITfFnBalloon { /// Changes the style and text of a language bar balloon item. /// Contains one of the TfLBBalloonStyle values that specifies the new balloon style. /// Pointer to a WCHAR buffer that contains the new text for the balloon. /// Contains the number of characters of the new text in pch. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// /// /// The language bar balloon implementation should update its style and text by modifying the values returned from /// ITfLangBarItemBalloon::GetBalloonInfo and then call ITfLangBarItemSink::OnUpdate with TF_LBI_BALLOON to cause the language /// bar to obtain the updated information. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnballoon-updateballoon HRESULT UpdateBalloon( // TfLBBalloonStyle style, const WCHAR *pch, ULONG cch ); [PreserveSig] HRESULT UpdateBalloon([In] TfLBBalloonStyle style, [In, MarshalAs(UnmanagedType.LPWStr)] string pch, uint cch); } /// /// /// The ITfFnConfigure interface is implemented by a text service to enable the Text Services control panel application to /// allow the text service to display a configuration dialog box. /// /// /// The Text Services control panel application obtains an instance of this interface by calling CoCreateInstance with the class /// identifier passed to ITfInputProcessorProfiles::Register and IID_ITfFnConfigure. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnconfigure [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnConfigure")] [ComImport, Guid("88F567C6-1757-49F8-A1B2-89234C1EEFF9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITfFnConfigure : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// /// Called when the user opens the Text Services control panel application, selects the text service from the list and presses /// the Properties pushbutton. /// /// /// Handle of the parent window. The text service typically uses this as the parent or owner window when creating a dialog box. /// /// /// Contains a LANGID value that specifies the identifier of the language selected in the Text Services control panel application. /// /// /// Contains a GUID value that specifies the language profile identifier that the text service is under. This is the value /// specified in ITfInputProcessorProfiles::AddLanguageProfile when the profile was added. /// /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// This method should not return until the user closes the dialog box or property sheet. // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnconfigure-show HRESULT Show( HWND hwndParent, // LANGID langid, REFGUID rguidProfile ); [PreserveSig] HRESULT Show([In] HWND hwndParent, [In] LANGID langid, in Guid rguidProfile); } /// /// The ITfFnConfigureRegisterEudc interface is implemented by a text service to provide the UI to register the key sequence /// for the given EUDC. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnconfigureregistereudc [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnConfigureRegisterEudc")] [ComImport, Guid("B5E26FF5-D7AD-4304-913F-21A2ED95A1B0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITfFnConfigureRegisterEudc : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// The ITfFnConfigureRegisterEudc::Show method shows the EUDC key sequence register UI. /// /// [in] Handle of the parent window. The text service typically uses this as the parent or owner window when creating a dialog box. /// /// [in] Contains a LANGID value that specifies the identifier of the language. /// /// [in] Contains a GUID value that specifies the language profile identifier that the text service is under. /// /// /// [in, unique] Contains a BSTR that contains the EUDC to be registered with the text service. This is optional and can be /// NULL. If NULL, the text service should display a default register EUDC dialog box. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnconfigureregistereudc-show HRESULT Show( HWND // hwndParent, LANGID langid, REFGUID rguidProfile, BSTR bstrRegistered ); [PreserveSig] HRESULT Show([In] HWND hwndParent, [In] LANGID langid, in Guid rguidProfile, [In, Optional, MarshalAs(UnmanagedType.BStr)] string bstrRegistered); } /// /// /// The ITfFnConfigureRegisterWord interface is implemented by a text service to enable the Active Input Method Editor (IME) /// to cause the text service to display a word registration dialog box. /// /// To obtain an instance of this interface the IME can call ITfFunctionProvider::GetFunction with IID_ITfFnConfigureRegisterWord. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnconfigureregisterword [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnConfigureRegisterWord")] [ComImport, Guid("BB95808A-6D8F-4BCA-8400-5390B586AEDF"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITfFnConfigureRegisterWord : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Called to cause the text service to display a dialog box to register a word with the text service. /// /// Handle of the parent window. The text service typically uses this as the parent or owner window when creating the dialog box. /// /// /// Contains a LANGID that specifies the identifier of the language currently used by the Input Method Editor (IME). /// /// /// Contains a GUID that specifies the language profile identifier that the text service is under. This is the value specified /// in ITfInputProcessorProfiles::AddLanguageProfile when the profile was added. /// /// /// Contains a BSTR that contains the word to be registered with the text service. This is optional and can be NULL. If /// NULL, the text service should display a default register word dialog box. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_NOTIMPL /// The text service does not implement this method. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnconfigureregisterword-show HRESULT Show( HWND // hwndParent, LANGID langid, REFGUID rguidProfile, BSTR bstrRegistered ); [PreserveSig] HRESULT Show([In] HWND hwndParent, [In] LANGID langid, in Guid rguidProfile, [In, Optional, MarshalAs(UnmanagedType.BStr)] string bstrRegistered); } /// Undocumented. /// [PInvokeData("ctffunc.h")] [ComImport, Guid("FCA6C349-A12F-43A3-8DD6-5A5A4282577B"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITfFnCustomSpeechCommand : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Undocumented. /// Undocumented. /// Undocumented. [PreserveSig] HRESULT SetSpeechCommandProvider([In, MarshalAs(UnmanagedType.IUnknown)] object pspcmdProvider); } /// /// /// The ITfFnGetPreferredTouchKeyboardLayout interface is implemented by a text service to specify the use of a particular /// keyboard layout supported by the inbox Windows 8 touch keyboard. /// /// /// When an IME is active the touch keyboard will use ITfFunctionProvider::GetFunction with /// IID_ITfFnGetPreferredTouchKeyboardLayout to query the IME for this function. /// /// If the function is not supported by the IME, then the touch keyboard will show the default layout for the language. /// /// /// For more information on the layouts which can be specified, see GetLayout. /// /// This interface applies only to IMEs written using the Text Services Framework and not to legacy IMM32 IMEs, and it only applies /// to the following input languages: /// /// /// /// Japanese /// /// /// Korean /// /// /// Simplified Chinese /// /// /// Traditional Chinese /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffngetpreferredtouchkeyboardlayout [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnGetPreferredTouchKeyboardLayout")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5F309A41-590A-4ACC-A97F-D8EFFF13FDFC")] public interface ITfFnGetPreferredTouchKeyboardLayout { /// /// Obtains the touch keyboard layout identifier of the layout that the IME directs the touch keyboard to show while the IME is active. /// /// Pointer to a TKBLayoutType enumeration that receives the layout type. /// Pointer to a WORD value that receives the layout identifier. /// The touch keyboard always expects S_OK. /// /// TKBLayoutType is an enumeration with the following values. /// /// /// TKBLT_UNDEFINED /// Undefined. /// /// /// TKBLT_CLASSIC /// The touch keyboard is to use a classic layout. Classic layouts represent the legacy layouts of physical keyboards. /// /// /// TKBLT_OPTIMIZED /// /// The touch keyboard is to use a touch-optimized layout. Touch-optimized layouts have been specifically designed with touch in mind. /// /// /// /// /// The layout identifiers returned by this API must be one from the following list. Each identifier is specific to a certain /// language, and these are all specific to the touch keyboard. There is no way to request support for other layouts, or to add /// new touch optimized layouts dynamically. /// /// /// /// Layout Definition /// Value /// Supported Input Language /// /// /// TKBL_UNDEFINED /// 0 /// n/a /// /// /// TKBL_CLASSIC_TRADITIONAL_CHINESE_PHONETIC /// 0x0404 /// CHT /// /// /// TKBL_CLASSIC_TRADITIONAL_CHINESE_CHANGJIE /// 0xF042 /// CHT /// /// /// TKBL_CLASSIC_TRADITIONAL_CHINESE_DAYI /// 0xF043 /// CHT /// /// /// TKBL_OPT_JAPANESE_ABC /// 0x0411 /// JPN /// /// /// TKBL_OPT_KOREAN_HANGUL_2_BULSIK /// 0x0412 /// KOR /// /// /// TKBL_OPT_SIMPLIFIED_CHINESE_PINYIN /// 0x0804 /// CHS /// /// /// TKBL_OPT_TRADITIONAL_CHINESE_PHONETIC /// 0x0404 /// CHT /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffngetpreferredtouchkeyboardlayout-getlayout HRESULT // GetLayout( TKBLayoutType *pTKBLayoutType, WORD *pwPreferredLayoutId ); [PreserveSig] HRESULT GetLayout(out TKBLayoutType pTKBLayoutType, out TKBLayoutId pwPreferredLayoutId); } /// /// /// The ITfFnGetSAPIObject interface is implemented by the Speech API (SAPI) text service. This interface is used by the TSF /// manager or a client (application or other text service) to obtain various SAPI objects. /// /// /// A client obtains an instance of this interface by obtaining the ITfFunctionProvider for the SAPI text service and calling /// ITfFunctionProvider::GetFunction with IID_ITfFnGetSAPIObject. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffngetsapiobject [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnGetSAPIObject")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5C0AB7EA-167D-4F59-BFB5-4693755E90CA")] public interface ITfFnGetSAPIObject : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Obtains a specified SAPI object. /// Contains a TfSapiObject value that specifies the SAPI object to obtain. /// /// Pointer to an IUnknown interface pointer that receives the requested SAPI object. The caller must release this /// interface when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// The requested object cannot be obtained. /// /// /// E_NOTIMPL /// The requested object is not implemented. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffngetsapiobject-get HRESULT Get( TfSapiObject sObj, // IUnknown **ppunk ); [PreserveSig] HRESULT Get([In] TfSapiObject sObj, [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppunk); } /// /// The ITfFnLangProfileUtil interface is implemented by the speech text service and used to provide utility methods for the /// speech text service. A text service can create an instance of this interface by calling CoCreateInstance with CLSID_SapiLayr and IID_ITfFnLangProfileUtil. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnlangprofileutil [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnLangProfileUtil")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("A87A8574-A6C1-4E15-99F0-3D3965F548EB")] public interface ITfFnLangProfileUtil : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Causes the speech text service to register its active profiles. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// The speech text service removed its active profiles based on user actions. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlangprofileutil-registeractiveprofiles HRESULT RegisterActiveProfiles(); [PreserveSig] HRESULT RegisterActiveProfiles(); /// Determines if the speech text service has a profile available for a specific language. /// Contains a LANGID that specifies the language that the query applies to. /// /// Pointer to a BOOL that receives nonzero if a profile is available for the language identified by langid or zero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pfAvailable is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlangprofileutil-isprofileavailableforlang HRESULT // IsProfileAvailableForLang( LANGID langid, BOOL *pfAvailable ); [PreserveSig] HRESULT IsProfileAvailableForLang([In] LANGID langid, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfAvailable); } /// The ITfFnLMInternal interface is not used. // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnlminternal [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnLMInternal")] [ComImport, Guid("04B825B1-AC9A-4F7B-B5AD-C7168F1EE445"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITfFnLMInternal : ITfFnLMProcessor { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Obtains the range of text that a reconversion applies to. /// Pointer to an ITfRange object that covers all or part of the text to be reconverted. /// /// /// Pointer to an ITfRange pointer that receives a range object that covers all of the text that can be reconverted. If none of /// the text covered by pRange can be reconverted, this parameters receives NULL. In this case, the method will return /// S_OK; the caller must verify that this parameter is not NULL before using the pointer. /// /// This parameter is optional and can be NULL. In this case, the range is not required. /// /// /// Pointer to a BOOL value that receives zero if none of the text covered by pRange can be reconverted or nonzero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// /// /// This method is identical to ITfFnReconversion::QueryRange. When ITfFnReconversion::QueryRange is called in the text /// service, the text service should forward the call to this method if a language model processor is installed. If no language /// model processor is installed, the text service should perform its default processing. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-queryrange HRESULT QueryRange( // ITfRange *pRange, ITfRange **ppNewRange, BOOL *pfAccepted ); [PreserveSig] new HRESULT QueryRange([In] ITfRange pRange, out ITfRange ppNewRange, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfAccepted); /// Determines if the language model text service supports a particular language. /// Contains a LANGID that specifies the identifier of the language that the query applies to. /// /// Pointer to a BOOL value that receives nonzero if the language model text service supports the language identified by /// langid or zero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pfAccepted is invalid. /// /// /// /// If a client can possibly generate more than one language identifier of text, it should query all with this method. // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-querylangid HRESULT QueryLangID( // LANGID langid, BOOL *pfAccepted ); [PreserveSig] new HRESULT QueryLangID([In] LANGID langid, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfAccepted); /// Obtains an ITfCandidateList object for a range from the language model text service. /// /// Pointer to an ITfRange object that covers the text to be reconverted. To obtain this range object, call ITfFnReconversion::QueryRange. /// /// Pointer to an ITfCandidateList pointer that receives the candidate list object. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// /// /// This method is identical to ITfFnReconversion::GetReconversion. When ITfFnReconversion::GetReconversion is called in /// the text service, the text service should forward the call to this method if a language model processor is installed. If no /// language model processor is installed, the text service should perform its default processing. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-getreconversion HRESULT // GetReconversion( ITfRange *pRange, ITfCandidateList **ppCandList ); [PreserveSig] new HRESULT GetReconversion([In] ITfRange pRange, out ITfCandidateList ppCandList); /// Invokes the reconversion process in the language model text service for a range. /// Pointer to an ITfRange object that covers the text to reconvert. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// pRange is invalid. /// /// /// /// /// This method is identical to ITfFnReconversion::Reconvet. When ITfFnReconversion::Reconvet is called in the text /// service, the text service should forward the call to this method if a language model processor is installed. If no language /// model processor is installed, the text service should perform its default processing. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-reconvert HRESULT Reconvert( ITfRange // *pRange ); [PreserveSig] new HRESULT Reconvert([In] ITfRange pRange); /// Called to determine if the language model text service handles a key event. /// /// Contains a BOOL that specifies if this is a key-down or a key-up event. Contains zero if this is a key-down event or /// nonzero otherwise. /// /// /// Contains the virtual-key code of the key. For more information about this parameter, see the wParam parameter in WM_KEYDOWN. /// /// /// Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag /// of the key. For more information about this parameter, see the lParam parameter in WM_KEYDOWN. /// /// /// Pointer to a BOOL that receives nonzero if the language model text service will handle the key event or zero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-querykey HRESULT QueryKey( BOOL fUp, // WPARAM vKey, LPARAM lparamKeydata, BOOL *pfInterested ); [PreserveSig] new HRESULT QueryKey(int fUp, [In] WPARAM vKey, [In] LPARAM lparamKeydata, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfInterested); /// Called to enable the language model text service to process a key event. /// /// Contains a BOOL that specifies if this is a key-down or a key-up event. Contains zero if this is a key-down event or /// nonzero otherwise. /// /// /// Contains the virtual-key code of the key. For more information about this parameter, see the wParam parameter in WM_KEYDOWN. /// /// /// Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag /// of the key. For more information about this parameter, see the lParam parameter in WM_KEYDOWN. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-invokekey HRESULT InvokeKey( BOOL fUp, // WPARAM vKey, LPARAM lparamKeyData ); [PreserveSig] new HRESULT InvokeKey(int fUp, [In] WPARAM vKey, [In] LPARAM lparamKeydata); /// Invokes a function of the language model text service. /// Pointer to an ITfContext interface that represents context to perform the function on. /// /// Contains a GUID that specifies the function to invoke. Possible values for this parameter are defined by the language model /// text service provider. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-invokefunc HRESULT InvokeFunc( // ITfContext *pic, REFGUID refguidFunc ); [PreserveSig] new HRESULT InvokeFunc([In] ITfContext pic, in Guid refguidFunc); /// Not used. /// Not used. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlminternal-processlattice HRESULT ProcessLattice( // ITfRange *pRange ); [PreserveSig] HRESULT ProcessLattice([In] ITfRange pRange); } /// /// /// The ITfFnLMProcessor interface is implemented by the language model text service and is used by an application or text /// service to enable alternate language model processing. /// /// /// The application or text service obtains this interface from a thread manager object by calling ITfThreadMgr::GetFunctionProvider /// with GUID_MASTERLM_FUNCTIONPROVIDER and then calling ITfFunctionProvider::GetFunction interface with IID_ITfFnLMProcessor. If /// ITfThreadMgr::GetFunctionProvider fails, then no language model processor is installed. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnlmprocessor [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnLMProcessor")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("7AFBF8E7-AC4B-4082-B058-890899D3A010")] public interface ITfFnLMProcessor : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Obtains the range of text that a reconversion applies to. /// Pointer to an ITfRange object that covers all or part of the text to be reconverted. /// /// /// Pointer to an ITfRange pointer that receives a range object that covers all of the text that can be reconverted. If none of /// the text covered by pRange can be reconverted, this parameters receives NULL. In this case, the method will return /// S_OK; the caller must verify that this parameter is not NULL before using the pointer. /// /// This parameter is optional and can be NULL. In this case, the range is not required. /// /// /// Pointer to a BOOL value that receives zero if none of the text covered by pRange can be reconverted or nonzero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// /// /// This method is identical to ITfFnReconversion::QueryRange. When ITfFnReconversion::QueryRange is called in the text /// service, the text service should forward the call to this method if a language model processor is installed. If no language /// model processor is installed, the text service should perform its default processing. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-queryrange HRESULT QueryRange( // ITfRange *pRange, ITfRange **ppNewRange, BOOL *pfAccepted ); [PreserveSig] HRESULT QueryRange([In] ITfRange pRange, out ITfRange ppNewRange, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfAccepted); /// Determines if the language model text service supports a particular language. /// Contains a LANGID that specifies the identifier of the language that the query applies to. /// /// Pointer to a BOOL value that receives nonzero if the language model text service supports the language identified by /// langid or zero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pfAccepted is invalid. /// /// /// /// If a client can possibly generate more than one language identifier of text, it should query all with this method. // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-querylangid HRESULT QueryLangID( // LANGID langid, BOOL *pfAccepted ); [PreserveSig] HRESULT QueryLangID([In] LANGID langid, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfAccepted); /// Obtains an ITfCandidateList object for a range from the language model text service. /// /// Pointer to an ITfRange object that covers the text to be reconverted. To obtain this range object, call ITfFnReconversion::QueryRange. /// /// Pointer to an ITfCandidateList pointer that receives the candidate list object. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// /// /// This method is identical to ITfFnReconversion::GetReconversion. When ITfFnReconversion::GetReconversion is called in /// the text service, the text service should forward the call to this method if a language model processor is installed. If no /// language model processor is installed, the text service should perform its default processing. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-getreconversion HRESULT // GetReconversion( ITfRange *pRange, ITfCandidateList **ppCandList ); [PreserveSig] HRESULT GetReconversion([In] ITfRange pRange, out ITfCandidateList ppCandList); /// Invokes the reconversion process in the language model text service for a range. /// Pointer to an ITfRange object that covers the text to reconvert. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// pRange is invalid. /// /// /// /// /// This method is identical to ITfFnReconversion::Reconvet. When ITfFnReconversion::Reconvet is called in the text /// service, the text service should forward the call to this method if a language model processor is installed. If no language /// model processor is installed, the text service should perform its default processing. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-reconvert HRESULT Reconvert( ITfRange // *pRange ); [PreserveSig] HRESULT Reconvert([In] ITfRange pRange); /// Called to determine if the language model text service handles a key event. /// /// Contains a BOOL that specifies if this is a key-down or a key-up event. Contains zero if this is a key-down event or /// nonzero otherwise. /// /// /// Contains the virtual-key code of the key. For more information about this parameter, see the wParam parameter in WM_KEYDOWN. /// /// /// Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag /// of the key. For more information about this parameter, see the lParam parameter in WM_KEYDOWN. /// /// /// Pointer to a BOOL that receives nonzero if the language model text service will handle the key event or zero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-querykey HRESULT QueryKey( BOOL fUp, // WPARAM vKey, LPARAM lparamKeydata, BOOL *pfInterested ); [PreserveSig] HRESULT QueryKey(int fUp, [In] WPARAM vKey, [In] LPARAM lparamKeydata, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfInterested); /// Called to enable the language model text service to process a key event. /// /// Contains a BOOL that specifies if this is a key-down or a key-up event. Contains zero if this is a key-down event or /// nonzero otherwise. /// /// /// Contains the virtual-key code of the key. For more information about this parameter, see the wParam parameter in WM_KEYDOWN. /// /// /// Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag /// of the key. For more information about this parameter, see the lParam parameter in WM_KEYDOWN. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-invokekey HRESULT InvokeKey( BOOL fUp, // WPARAM vKey, LPARAM lparamKeyData ); [PreserveSig] HRESULT InvokeKey(int fUp, [In] WPARAM vKey, [In] LPARAM lparamKeydata); /// Invokes a function of the language model text service. /// Pointer to an ITfContext interface that represents context to perform the function on. /// /// Contains a GUID that specifies the function to invoke. Possible values for this parameter are defined by the language model /// text service provider. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnlmprocessor-invokefunc HRESULT InvokeFunc( // ITfContext *pic, REFGUID refguidFunc ); [PreserveSig] HRESULT InvokeFunc([In] ITfContext pic, in Guid refguidFunc); } /// /// /// The ITfFnPlayBack interface is implemented by the Speech API (SAPI) text service. This interface is used by the TSF /// manager or a client (application or other text service) to control the audio data for speech input text. /// /// /// Each spoken word or phrase has audio data stored with the text. This interface is used to obtain the range that covers the /// spoken text and to play back the audio data. /// /// /// A client obtains an instance of this interface by obtaining the ITfFunctionProvider for the SAPI text service and calling /// ITfFunctionProvider::GetFunction with IID_ITfFnPlayBack. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnplayback [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnPlayBack")] [ComImport, Guid("A3A416A4-0F64-11D3-B5B7-00C04FC324A1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITfFnPlayBack : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Obtains the range of text for a word or phrase that contains audio data. /// Pointer to an ITfRange object that covers all or part of the text that contains audio data. /// /// Pointer to an ITfRange pointer that receives a range object that covers all of the text that contains audio data. If there /// is no audio data for the text covered by pRange, this parameters receives NULL. In this case, the method returns /// S_OK, so the caller must verify that this parameter is not NULL before using the pointer. /// /// /// Pointer to a BOOL that receives zero if none of the text covered by pRange has any audio data or nonzero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// /// /// The current implementation of this method is simple. It clones pRange, places the clone in ppNewRange, sets pfPlayable to /// TRUE and returns S_OK. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnplayback-queryrange HRESULT QueryRange( ITfRange // *pRange, ITfRange **ppNewRange, BOOL *pfPlayable ); [PreserveSig] HRESULT QueryRange([In] ITfRange pRange, out ITfRange ppNewRange, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfPlayable); /// Causes the audio data for a range of text to be played. /// /// /// Pointer to an ITfRange object that covers the text to play the audio data for. This range object is obtained by calling ITfFnPlayBack::QueryRange. /// /// /// If the range has zero length, the range played is expanded to cover the entire spoken phrase. If the range has a nonzero /// length, the range played is expanded to include the entire word, or words, that the range partially covers. /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnplayback-play HRESULT Play( ITfRange *pRange ); [PreserveSig] HRESULT Play([In] ITfRange pRange); } /// /// /// The ITfFnPropertyUIStatus interface is implemented by a text service and used by an application or text service to obtain /// and set the status of the text service property UI. /// /// /// An application or text service obtains an instance of this interface by obtaining the ITfFunctionProvider for the text service /// and calling ITfFunctionProvider::GetFunction with IID_ITfFnPropertyUIStatus. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnpropertyuistatus [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnPropertyUIStatus")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("2338AC6E-2B9D-44C0-A75E-EE64F256B3BD")] public interface ITfFnPropertyUIStatus : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Obtains the status of a text service property UI. /// /// Specifies the property identifier. This can be a custom identifier or one of the predefined property identifiers. /// /// /// Pointer to a DWORD that recevies the property UI status. This can be zero or the following value. /// /// /// Value /// Meaning /// /// /// TF_PROPUI_STATUS_SAVETOFILE /// The property can be serialized. If this value is not present, the property cannot be serialized. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pdw is invalid. /// /// /// E_NOTIMPL /// The text service does not support this method. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnpropertyuistatus-getstatus HRESULT GetStatus( // REFGUID refguidProp, DWORD *pdw ); [PreserveSig] HRESULT GetStatus(in Guid refguidProp, out TF_PROPUI_STATUS pdw); /// Modifies the status of a text service property UI. /// /// Specifies the property identifier. This can be a custom identifier or one of the predefined property identifiers. /// /// /// Contains the new property UI status. See the pdw parameter of ITfFnPropertyUIStatus::GetStatus for possible values. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_NOTIMPL /// The text service does not support this method. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnpropertyuistatus-setstatus HRESULT SetStatus( // REFGUID refguidProp, DWORD dw ); [PreserveSig] HRESULT SetStatus(in Guid refguidProp, TF_PROPUI_STATUS dw); } /// /// /// The ITfFnReconversion interface is implemented by a text service and is used by the TSF manager or a client to support /// reconversion of text provided by the text service. /// /// /// The TSF manager implements this interface to provide access to this interface to other clients. This allows the TSF manager to /// function as a mediator between the client and the text service. /// /// The TSF manager obtains this interface by calling the text service ITfFunctionProvider::GetFunction method with IID_ITfFnReconversion. /// An application obtains this interface by calling the TSF manager ITfFunctionProvider::GetFunction method with IID_ITfFnReconversion. /// /// /// When a text service must interpret text before it is inserted into a context, there might be more than one possible /// interpretation of the text. Speech input is an example of this. If the spoken word is "there", other possible interpretations /// might be "their" or "they're". The text service will insert the most appropriate text, but there is still some chance of error /// involved. Text reconversion is the process of allowing the user to select alternate text for the inserted text. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnreconversion [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnReconversion")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4CEA93C0-0A58-11D3-8DF0-00105A2799B5")] public interface ITfFnReconversion : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// The ITfFnReconversion::QueryRange method obtains the range of text that the reconversion applies to. /// Pointer to an ITfRange object that covers all or part of the text to be reconverted. /// /// /// [in, out] Pointer to an ITfRange pointer that receives a range object that covers all of text that can be reconverted. If /// none of the text covered by pRange can be reconverted, this parameters receives NULL. In this case, the method will return /// S_OK, so the caller must verify that this parameter is not NULL before using the pointer. /// /// /// When this method is implemented by a text service, this parameter is optional and can be NULL. In this case, the range is /// not required. /// /// When the TSF manager implementation of this method is called, this parameter is not optional and cannot be NULL. /// /// /// Pointer to a BOOL value that receives zero if none of the text covered by pRange can be reconverted or nonzero otherwise. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnreconversion-queryrange HRESULT QueryRange( // ITfRange *pRange, ITfRange **ppNewRange, BOOL *pfConvertable ); [PreserveSig] HRESULT QueryRange([In] ITfRange pRange, out ITfRange ppNewRange, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfConvertable); /// Obtains an ITfCandidateList object for a range of text. /// /// Pointer to an ITfRange object that covers the text to be reconverted. This range object is obtained by calling ITfFnReconversion::QueryRange. /// /// Pointer to an ITfCandidateList pointer that receives the candidate list object. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnreconversion-getreconversion HRESULT // GetReconversion( ITfRange *pRange, ITfCandidateList **ppCandList ); [PreserveSig] HRESULT GetReconversion([In] ITfRange pRange, out ITfCandidateList ppCandList); /// Invokes the reconversion process for a range of text. /// /// Pointer to an ITfRange object that covers the text to be reconverted. To obtain this range object call ITfFnReconversion::QueryRange. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// /// /// If this method causes some type of user interface to be displayed, such as a dialog box, this method must not wait for the /// UI to be dismissed before returning. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnreconversion-reconvert HRESULT Reconvert( ITfRange // *pRange ); [PreserveSig] HRESULT Reconvert([In] ITfRange pRange); } /// Enables an integrated search experience in an Input Method Editor (IME). /// /// /// Implement the ITfFnSearchCandidateProvider interface in your Input Method Editor (IME) to enable an integrated search /// experience. Implementing this interface enables searches with meaningful results to begin before IME input has been completed, /// by providing a set of possible IME conversion candidates for a given input string. Apps can use this interface to obtain IME /// conversions for a string, so the ITfFnSearchCandidateProvider interface, along with ITfFnGetLinguisticAlternates, /// provides a TSF-based replacement for the ImmGetConversionList function. Typically IMEs implement either /// ITfFnGetLinguisticAlternates or ITfFnSearchCandidateProvider (or neither). /// /// /// Call GetFunctionProvider with the CLSID of a text service to get an ITfFunctionProvider instance. Use the following call to the /// ITfFunctionProvider::GetFunction method to get the ITfFnSearchCandidateProvider interface pointer. /// /// /// ITfFunctionProvider::GetFunction(GUID_NULL, IID_ITfFnSearchCandidateProvider, &pSearchCandidate) /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnsearchcandidateprovider [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnSearchCandidateProvider")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("87a2ad8f-f27b-4920-8501-67602280175d")] public interface ITfFnSearchCandidateProvider : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Gets a list of conversion candidates for a given string without generating any IME-related messages or events. /// A string that specifies the reading string that the text service attempts to convert. /// /// App-specified string that enables a text service to optionally provide different candidates to different apps or contexts /// based on input history. You can pass an empty BSTR, L””, for a generic context. /// /// An ITfCandidateList that receives the requested candidate data. /// /// This method can return one of these values. /// /// /// Return code /// Description /// /// /// S_OK /// The method was successful. /// /// /// S_FALSE /// No candidates could be returned for the input string, pplist may be NULL. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnsearchcandidateprovider-getsearchcandidates // HRESULT GetSearchCandidates( BSTR bstrQuery, BSTR bstrApplicationId, ITfCandidateList **pplist ); [PreserveSig] HRESULT GetSearchCandidates([In, MarshalAs(UnmanagedType.BStr)] string bstrQuery, [In, MarshalAs(UnmanagedType.BStr)] string bstrApplicationId, out ITfCandidateList pplist); /// Provides a text Service or IME with history data when a candidate is chosen by the user. /// The reading string for the text service or IME to convert. /// /// App-specified string that enables a text service or IME to optionally provide different candidates to different apps or /// contexts based on input history. You can pass an empty BSTR, L””, for a generic context. /// /// /// A string that represents the candidate string chosen by the user. It should be one of the candidate string values returned /// by the GetSearchCandidates method. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// Implementing and calling the SetResult method is optional. /// /// A text service or IME can return E_PENDING if no corresponding call to GetSearchCandidates has been made yet for the /// value of bstrQuery. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnsearchcandidateprovider-setresult HRESULT // SetResult( BSTR bstrQuery, BSTR bstrApplicationID, BSTR bstrResult ); [PreserveSig] HRESULT SetResult([In, MarshalAs(UnmanagedType.BStr)] string bstrQuery, [In, MarshalAs(UnmanagedType.BStr)] string bstrApplicationID, [In, MarshalAs(UnmanagedType.BStr)] string bstrResult); }; /// /// The ITfFnShowHelp interface is implemented by a text service to enable the language bar to place a help command for the /// text service in the language bar help menu. /// /// /// /// The TSF manager obtains this interface from the text service by calling the text service ITfFunctionProvider::GetFunction /// interface with IID_ITfFnShowHelp. /// /// The TSF manager obtains the help menu text by calling the text service's ITfFunction::GetDisplayName. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itffnshowhelp [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfFnShowHelp")] [ComImport, Guid("5AB1D30C-094D-4C29-8EA5-0BF59BE87BF3"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITfFnShowHelp : ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] new HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); /// Called when the user selects a text service help menu item. /// Handle of the parent window. This value can be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// The text service should not wait for the help UI to be complete before returning from this method. // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itffnshowhelp-show HRESULT Show( HWND hwndParent ); [PreserveSig] HRESULT Show([In] HWND hwndParent); } /// /// The ITfFunction interface is the base interface for the individual function interfaces. This interface is implemented by /// the provider of the function object and used by any component to obtain the display name of the function object. Instances of /// this interface are not obtained directly. This interface is always part of a derived interface, such as ITfFnShowHelp. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nn-msctf-itffunction [PInvokeData("msctf.h", MSDNShortId = "NN:msctf.ITfFunction")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("DB593490-098F-11D3-8DF0-00105A2799B5")] public interface ITfFunction { /// Obtains the function display name. /// /// Pointer to a BSTR value that receives the display name. This value must be allocated using SysAllocString. The caller must /// free this memory using SysFreeString when it is no longer required. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// pbstrName is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itffunction-getdisplayname HRESULT GetDisplayName( BSTR // *pbstrName ); [PreserveSig] HRESULT GetDisplayName([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrName); } /// Enables text services and Input Method Editors (IMEs) to adjust UI-less mode behavior. /// /// /// The ITfIntegratableCandidateListUIElement interface is implemented by text services and Input Method Editors (IMEs) to /// adjust UI-less mode behavior for a better UI and keyboarding experience in IME-integrated controls, like the Windows 8 Search /// box. The interface is used by apps that need a more streamlined UI and keyboarding experience with IME languages. /// /// /// You can get an ITfIntegratableCandidateListUIElement interface pointer by calling QueryInterface on the ITfUIElement /// interface pointer that's provided by using the dwUIElementId parameters of the ITfUIElementSink callback functions to obtain the /// interface from ITfUIElementMgr. /// /// /// The ITfIntegratableCandidateListUIElement interface is an optional interface that's implemented by a text service or IME /// that needs greater control over how its UI is presented in UI-less mode. Apps can use it to implement more streamlined, /// special-purpose input controls, as in auto-complete or search suggestions. /// /// /// Implement the ITfIntegratableCandidateListUIElement interface in the same class that implements the ITfUIElement, /// ITfCandidateListUIElement, and ITfCandidateListUIElementBehavior interfaces. These interfaces work together to create a fully /// integrated experience in which the app renders candidate list UI for the text service or IME and can also have some IME-specific /// UI customization and keyboard interaction behavior. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itfintegratablecandidatelistuielement [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfIntegratableCandidateListUIElement")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("C7A6F54F-B180-416F-B2BF-7BF2E4683D7B")] public interface ITfIntegratableCandidateListUIElement { /// Sets the integration style. /// The desired type of keyboard integration experience. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The text service supports the integration style. /// /// /// E_NOTIMPL /// The text service does not support the integration style. /// /// /// /// /// If an app needs a keyboard-integrated experience, it can set a GUID for the desired type of integration experience. /// If the text service supports the integration style, it should return S_OK. If it's not supported, it should return /// E_NOTIMPL. When called, the text service may adjust its respond to keyboard interaction for the lifetime of the /// ITfCandidateListUIElement object, for example, until ITfUIElementSink::EndUIElement is called. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itfintegratablecandidatelistuielement-setintegrationstyle // HRESULT SetIntegrationStyle( GUID guidIntegrationStyle ); [PreserveSig] HRESULT SetIntegrationStyle(in Guid guidIntegrationStyle); /// Retrieves the selection style. /// A value that specifies the selection style. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// The active selection style usually indicates that the selection can be changed with the arrow keys. The implied selection /// style indicates the default selection key chooses it. If the app supports changing selection styles, this method should be /// called when the UpdateUIElement method is called. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itfintegratablecandidatelistuielement-getselectionstyle // HRESULT GetSelectionStyle( TfIntegratableCandidateListSelectionStyle *ptfSelectionStyle ); [PreserveSig] HRESULT GetSelectionStyle(out TfIntegratableCandidateListSelectionStyle ptfSelectionStyle); /// Processes a key press. /// /// Specifies the virtual-key code of the key. For more information about this parameter, see the wParam parameter in WM_KEYDOWN. /// /// /// Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag /// of the key. For more information about this parameter, see the lParam parameter in WM_KEYDOWN. /// /// TRUE if the key event was handled; otherwise, FALSE. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// The OnKeyDown method enables an app to ask query the text service if it wants to process a given key in an integration /// style. The behavior of the OnKeyDown method can depend on the integration style. If the text service returns /// *pfEaten= TRUE, then the app should do no processing of the key. If FALSE is returned, the app can perform its /// own action in response to the key. /// /// /// GUID_INTEGRATIONSTYLE_SEARCHBOX ({E6D1BD11-82F7-4903-AE21-1A6397CDE2EB}) enables an implementation of a keyboarding /// experience in which the user can move perceived keyboard focus from the search box to the candidate list to search /// suggestions. The text service can process keys like VK_UP and VK_DOWN before Search handles them to change its /// internal state. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itfintegratablecandidatelistuielement-onkeydown HRESULT // OnKeyDown( WPARAM wParam, LPARAM lParam, BOOL *pfEaten ); [PreserveSig] HRESULT OnKeyDown([In] WPARAM wParam, [In] LPARAM lParam, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfEaten); /// Specifies whether candidate numbers should be shown. /// TRUE if candidate numbers should be shown; otherwise FALSE. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itfintegratablecandidatelistuielement-showcandidatenumbers // HRESULT ShowCandidateNumbers( BOOL *pfShow ); [PreserveSig] HRESULT ShowCandidateNumbers([Out, MarshalAs(UnmanagedType.Bool)] out bool pfShow); /// Enables text services and Input Method Editors (IMEs) to adjust UI-less mode behavior. /// /// /// The ITfIntegratableCandidateListUIElement interface is implemented by text services and Input Method Editors (IMEs) /// to adjust UI-less mode behavior for a better UI and keyboarding experience in IME-integrated controls, like the Windows 8 /// Search box. The interface is used by apps that need a more streamlined UI and keyboarding experience with IME languages. /// /// /// You can get an ITfIntegratableCandidateListUIElement interface pointer by calling QueryInterface on the ITfUIElement /// interface pointer that's provided by using the dwUIElementId parameters of the ITfUIElementSink callback functions to obtain /// the interface from ITfUIElementMgr. /// /// /// The ITfIntegratableCandidateListUIElement interface is an optional interface that's implemented by a text service or /// IME that needs greater control over how its UI is presented in UI-less mode. Apps can use it to implement more streamlined, /// special-purpose input controls, as in auto-complete or search suggestions. /// /// /// Implement the ITfIntegratableCandidateListUIElement interface in the same class that implements the ITfUIElement, /// ITfCandidateListUIElement, and ITfCandidateListUIElementBehavior interfaces. These interfaces work together to create a /// fully integrated experience in which the app renders candidate list UI for the text service or IME and can also have some /// IME-specific UI customization and keyboard interaction behavior. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itfintegratablecandidatelistuielement [PreserveSig] HRESULT FinalizeExactCompositionString(); } /// /// The ITfLMLattice interface is implemented by the speech text service to provide information about lattice element /// properties and is used by a client (application or other text service). A client obtains this interface from the /// GUID_PROP_LMLATTICE property by calling ITfReadOnlyProperty::GetValue. For more information, see Predefined Properties. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nn-ctffunc-itflmlattice [PInvokeData("ctffunc.h", MSDNShortId = "NN:ctffunc.ITfLMLattice")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("D4236675-A5BF-4570-9D42-5D6D7B02D59B")] public interface ITfLMLattice { /// Determines if a specific lattice element type is supported by the lattice property. /// Specifies the lattice type identifier. This can be one of the Lattice Type values. /// /// Pointer to a BOOL that receives a value that indicates if the lattice type is supported. If the lattice type is /// supported, this parameter receives a nonzero value and the method returns S_OK. If the lattice type is unsupported, this /// parameter receives zero and the method returns E_INVALIDARG. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itflmlattice-querytype HRESULT QueryType( REFGUID // rguidType, BOOL *pfSupported ); [return: MarshalAs(UnmanagedType.Bool)] bool QueryType(in Guid rguidType); /// /// Obtains an enumerator that contains all lattice elements contained in the lattice property that start at or after a specific /// offset from the start of the frame. /// /// /// Specifies the offset, in 100-nanosecond units, relative to the start of the phrase, of the first element to obtain. /// /// Specifies the lattice type identifier. This can be one of the Lattice Type values. /// Pointer to an IEnumTfLatticeElements interface pointer that receives the enumerator object. // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/nf-ctffunc-itflmlattice-enumlatticeelements HRESULT // EnumLatticeElements( DWORD dwFrameStart, REFGUID rguidType, IEnumTfLatticeElements **ppEnum ); IEnumTfLatticeElements EnumLatticeElements(uint dwFrameStart, in Guid rguidType); } /// /// The TF_LMLATTELEMENT structure contains information about a lattice element. A lattice element is used in speech /// recognition. This structure is used with the IEnumTfLatticeElements::Next method. /// // https://docs.microsoft.com/en-us/windows/win32/api/ctffunc/ns-ctffunc-tf_lmlattelement typedef struct TF_LMLATTELEMENT { DWORD // dwFrameStart; DWORD dwFrameLen; DWORD dwFlags; union { INT iCost; }; BSTR bstrText; } TF_LMLATTELEMENT; [PInvokeData("ctffunc.h", MSDNShortId = "NS:ctffunc.TF_LMLATTELEMENT")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("1B646EFE-3CE3-4CE2-B41F-35B93FE5552F")] public struct TF_LMLATTELEMENT { /// Contains the starting offset, in 100-nanosecond units, of the element relative to the start of the phrase. public uint dwFrameStart; /// Contains the length, in 100-nanosecond units, of the element. public uint dwFrameLen; /// Not currently used. public uint dwFlags; /// /// Specifies the actual confidence for this element. This can be one of the following values. /// /// /// Value /// Meaning /// /// /// SP_LOW_CONFIDENCE /// The speech engine has low confidence in the element. /// /// /// SP_NORMAL_CONFIDENCE /// The speech engine has normal confidence in the element. /// /// /// SP_HIGH_CONFIDENCE /// The speech engine has high confidence in the element. /// /// /// public SP_CONFIDENCE iCost; /// /// Contains the display text for the element. If the spoken word is "two", the display text will be "2". The caller must free /// this string using SysFreeString when it is no longer required. /// [MarshalAs(UnmanagedType.BStr)] public string bstrText; } } }