using System; using System.Runtime.InteropServices; using Vanara.InteropServices; using HKL = System.IntPtr; namespace Vanara.PInvoke { public static partial class MSCTF { /// Indicates to a text service that the client is deactivated. See TfClientId. public const uint TF_CLIENTID_NULL = 0; /// public const uint TF_DEFAULT_SELECTION = unchecked((uint)-1); /// Used to notify TSF, through atom functions, that a thread input process has been enabled. public const string TF_ENABLE_PROCESS_ATOM = "_CTF_ENABLE_PROCESS_ATOM_"; /// Not used. public const uint TF_INVALID_COOKIE = unchecked((uint)-1); /// The TfGuidAtom value for the current process is invalid. public const uint TF_INVALID_GUIDATOM = 0; /// public const uint TF_INVALID_UIELEMENTID = unchecked((uint)-1); /// Used to notify atom functions that a thread input process has initiated. public const string TF_PROCESS_ATOM = "_CTF_PROCESS_ATOM_"; #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member /// /// Obtains the function provider implemented by the current application. This object is not available if the application does not /// register itself as a function provider. /// public static readonly Guid GUID_APP_FUNCTIONPROVIDER = new Guid("4caef01e-12af-4b0e-9db1-a6ec5b881208"); public static readonly Guid GUID_COMPARTMENT_EMPTYCONTEXT = new Guid("d7487dbf-804e-41c5-894d-ad96fd4eea13"); public static readonly Guid GUID_COMPARTMENT_HANDWRITING_OPENCLOSE = new Guid("f9ae2c6b-1866-4361-af72-7aa30948890e"); public static readonly Guid GUID_COMPARTMENT_KEYBOARD_DISABLED = new Guid("71a5b253-1951-466b-9fbc-9c8808fa84f2"); public static readonly Guid GUID_COMPARTMENT_KEYBOARD_INPUTMODE_CONVERSION = new Guid("ccf05dd8-4a87-11d7-a6e2-00065b84435c"); public static readonly Guid GUID_COMPARTMENT_KEYBOARD_INPUTMODE_SENTENCE = new Guid("ccf05dd9-4a87-11d7-a6e2-00065b84435c"); public static readonly Guid GUID_COMPARTMENT_KEYBOARD_OPENCLOSE = new Guid("58273aad-01bb-4164-95c6-755ba0b5162d"); public static readonly Guid GUID_COMPARTMENT_PERSISTMENUENABLED = new Guid("575f3783-70c8-47c8-ae5d-91a01a1f7592"); public static readonly Guid GUID_COMPARTMENT_SPEECH_DISABLED = new Guid("56c5c607-0703-4e59-8e52-cbc84e8bbe35"); public static readonly Guid GUID_COMPARTMENT_SPEECH_GLOBALSTATE = new Guid("2a54fe8e-0d08-460c-a75d-87035ff436c5"); public static readonly Guid GUID_COMPARTMENT_SPEECH_OPENCLOSE = new Guid("544d6a63-e2e8-4752-bbd1-000960bca083"); public static readonly Guid GUID_COMPARTMENT_TIPUISTATUS = new Guid("148ca3ec-0366-401c-8d75-ed978d85fbc9"); public static readonly Guid GUID_COMPARTMENT_TRANSITORYEXTENSION = new Guid("8be347f5-c7a0-11d7-b408-00065b84435c"); public static readonly Guid GUID_COMPARTMENT_TRANSITORYEXTENSION_DOCUMENTMANAGER = new Guid("8be347f7-c7a0-11d7-b408-00065b84435c"); public static readonly Guid GUID_COMPARTMENT_TRANSITORYEXTENSION_PARENT = new Guid("8be347f8-c7a0-11d7-b408-00065b84435c"); public static readonly Guid GUID_INTEGRATIONSTYLE_SEARCHBOX = new Guid("E6D1BD11-82F7-4903-AE21-1A6397CDE2EB"); public static readonly Guid GUID_MODEBIAS_CHINESE = new Guid("7add26de-4328-489b-83ae-6493750cad5c"); public static readonly Guid GUID_MODEBIAS_CONVERSATION = new Guid("0f4ec104-1790-443b-95f1-e10f939d6546"); public static readonly Guid GUID_MODEBIAS_DATETIME = new Guid("f2bdb372-7f61-4039-92ef-1c35599f0222"); public static readonly Guid GUID_MODEBIAS_FILENAME = new Guid("d7f707fe-44c6-4fca-8e76-86ab50c7931b"); public static readonly Guid GUID_MODEBIAS_FULLWIDTHALPHANUMERIC = new Guid("81489fb8-b36a-473d-8146-e4a2258b24ae"); public static readonly Guid GUID_MODEBIAS_FULLWIDTHHANGUL = new Guid("c01ae6c9-45b5-4fd0-9cb1-9f4cebc39fea"); public static readonly Guid GUID_MODEBIAS_HALFWIDTHALPHANUMERIC = new Guid("c6f24fc0-4479-46ed-938a-6052b1653d3b"); public static readonly Guid GUID_MODEBIAS_HALFWIDTHKATAKANA = new Guid("005f6b63-78d4-41cc-8859-485ca821a795"); public static readonly Guid GUID_MODEBIAS_HANGUL = new Guid("76ef0541-23b3-4d77-a074-691801ccea17"); public static readonly Guid GUID_MODEBIAS_HIRAGANA = new Guid("d73d316e-9b91-46f1-a280-31597f52c694"); public static readonly Guid GUID_MODEBIAS_KATAKANA = new Guid("2e0eeddd-3a1a-499e-8543-3c7ee7949811"); public static readonly Guid GUID_MODEBIAS_NAME = new Guid("fddc10f0-d239-49bf-b8fc-5410caaa427e"); public static readonly Guid GUID_MODEBIAS_NONE = Guid.Empty; public static readonly Guid GUID_MODEBIAS_NUMERIC = new Guid("4021766c-e872-48fd-9cee-4ec5c75e16c3"); public static readonly Guid GUID_MODEBIAS_READING = new Guid("e31643a3-6466-4cbf-8d8b-0bd4d8545461"); public static readonly Guid GUID_MODEBIAS_URLHISTORY = new Guid("8b0e54d9-63f2-4c68-84d4-79aee7a59f09"); /// /// Contains a TfGuidAtom value that represents the GUID of the display attribute. ITfCategoryMgr::GetGUID is used to convert this /// value into a GUID. For more information, see Using Display Attributes. /// [CorrespondingType(typeof(uint))] public static readonly Guid GUID_PROP_ATTRIBUTE = new Guid("34b45670-7526-11d2-a147-00105a2799b5"); /// /// Contains a Boolean value that is nonzero if the text is part of a composition or zero otherwise. If this property is VT_EMPTY, /// it can be assumed that the text is not part of a composition. /// [CorrespondingType(typeof(bool))] public static readonly Guid GUID_PROP_COMPOSING = new Guid("e12ac060-af15-11d2-afc5-00105a2799b5"); /// Contains a DWORD value that contains the language identifier ( LANGID ) of the text in the low word. [CorrespondingType(typeof(LANGID))] public static readonly Guid GUID_PROP_LANGID = new Guid("3280ce20-8032-11d2-b603-00105a2799b5"); [CorrespondingType(typeof(LANGID))] public static readonly Guid GUID_PROP_LMLATTICE = new(0x8189b801, 0xd62f, 0x400a, 0x8c, 0x12, 0xe2, 0x93, 0x40, 0x96, 0x7b, 0xa8); /// Contains a pointer to an ITfLMLattice object. [CorrespondingType(typeof(ITfLMLattice))] public static readonly Guid GUID_PROP_MODEBIAS = new Guid("372e0716-974f-40ac-a088-08cdc92ebfbc"); /// /// Contains the phonetic reading text for the text covered by the property. This can be different from the actual text. Windows /// Store apps don't support this property. /// [CorrespondingType(typeof(string))] public static readonly Guid GUID_PROP_READING = new Guid("5463f7c0-8e31-11d2-bf46-00105a2799b5"); /// /// Contains a TfGuidAtom value that represents the class identifier ( CLSID ) of the text service that owns the text. /// ITfCategoryMgr::GetGUID is used to convert this value into a CLSID. /// [CorrespondingType(typeof(uint))] public static readonly Guid GUID_PROP_TEXTOWNER = new Guid("f1e2d520-0969-11d3-8df0-00105a2799b5"); /// /// Starting with Windows 8: Contains a DWORD value set by the touch keyboard. This property can be used by TSF-aware edit controls /// and apps to identify the nature of the text in the text range covered by the property, for example, if the text in the range /// results from the insertion of a text suggestion or autocorrection. /// /// The nature of the text in the text range covered by the property also extends to the type of alternates that would be returned /// by the ITfFnReconversion interface for that text range in the document. /// /// See the following Remarks for the possible values of this property. /// [CorrespondingType(typeof(TKB_ALTERNATES))] public static readonly Guid GUID_PROP_TKB_ALTERNATES = new Guid("70B2A803-968D-462E-B93B-2164C91517F7"); /// Obtains the TSF system function provider. public static readonly Guid GUID_SYSTEM_FUNCTIONPROVIDER = new Guid("9a698bb0-0f21-11d3-8df1-00105a2799b5"); public static readonly Guid GUID_TFCAT_CATEGORY_OF_TIP = new Guid("534c48c1-0607-4098-a521-4fc899c73e90"); public static readonly Guid GUID_TFCAT_DISPLAYATTRIBUTEPROPERTY = new Guid("b95f181b-ea4c-4af1-8056-7c321abbb091"); public static readonly Guid GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER = new Guid("046b8c80-1647-40f7-9b21-b93b81aabc1b"); public static readonly Guid GUID_TFCAT_PROP_AUDIODATA = new Guid("9b7be3a9-e8ab-4d47-a8fe-254fa423436d"); public static readonly Guid GUID_TFCAT_PROP_INKDATA = new Guid("7c6a82ae-b0d7-4f14-a745-14f28b009d61"); public static readonly Guid GUID_TFCAT_PROPSTYLE_CUSTOM = new Guid("25504FB4-7BAB-4BC1-9C69-CF81890F0EF5"); public static readonly Guid GUID_TFCAT_PROPSTYLE_STATIC = new Guid("565fb8d8-6bd4-4ca1-b223-0f2ccb8f4f96"); public static readonly Guid GUID_TFCAT_PROPSTYLE_STATICCOMPACT = new Guid("85f9794b-4d19-40d8-8864-4e747371a66d"); public static readonly Guid GUID_TFCAT_TIP_HANDWRITING = new Guid("246ecb87-c2f2-4abe-905b-c8b38add2c43"); public static readonly Guid GUID_TFCAT_TIP_KEYBOARD = new Guid("34745c63-b2f0-4784-8b67-5e12c8701a31"); public static readonly Guid GUID_TFCAT_TIP_SPEECH = new Guid("b5a73cd1-8355-426b-a161-259808f26b14"); public static readonly Guid GUID_TFCAT_TIPCAP_COMLESS = new Guid("364215d9-75bc-11d7-a6ef-00065b84435c"); public static readonly Guid GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT = new Guid("13A016DF-560B-46CD-947A-4C3AF1E0E35D"); public static readonly Guid GUID_TFCAT_TIPCAP_INPUTMODECOMPARTMENT = new Guid("ccf05dd7-4a87-11d7-a6e2-00065b84435c"); public static readonly Guid GUID_TFCAT_TIPCAP_SECUREMODE = new Guid("49d2f9ce-1f5e-11d7-a6d3-00065b84435c"); public static readonly Guid GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT = new Guid("13A016DF-560B-46CD-947A-4C3AF1E0E35D"); public static readonly Guid GUID_TFCAT_TIPCAP_UIELEMENTENABLED = new Guid("49d2f9cf-1f5e-11d7-a6d3-00065b84435c"); public static readonly Guid GUID_TFCAT_TIPCAP_WOW16 = new Guid("364215da-75bc-11d7-a6ef-00065b84435c"); #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member /// /// /// The Text Services Framework produces return values in the range from 0xHHHH0200 through 0xHHHH0507. The following table gives /// the manager return values in alphabetical order. /// /// /// Note /// /// The descriptions supplied are non-specific; the meaning of a return value can vary depending on the method that returned the value. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/tsf/manager-return-values [PInvokeData("msctf.h")] public enum ManagerReturnValues : int { /// The preserved key is registered. TF_E_ALREADY_EXISTS = unchecked((int)0x80040506), /// The context owner rejected the composition. TF_E_COMPOSITION_REJECTED = unchecked((int)0x80040508), /// The context object is not on a document stack. TF_E_DISCONNECTED = unchecked((int)0x80040504), /// The context is empty. TF_E_EMPTYCONTEXT = unchecked((int)0x80040509), /// Context owner cannot handle objects of the type provided by the pDataObject parameter. TF_E_FORMAT = unchecked((int)0x8004020a), /// The screen coordinates are invalid. TF_E_INVALIDPOINT = unchecked((int)0x80040207), /// The character position is invalid. TF_E_INVALIDPOS = unchecked((int)0x80040200), /// The context view is invalid. TF_E_INVALIDVIEW = unchecked((int)0x80040505), /// The context is already locked. TF_E_LOCKED = unchecked((int)0x80040500), /// The object does not support the requested interface. TF_E_NOINTERFACE = unchecked((int)0x80040204), /// The text layout has not been calculated. TF_E_NOLAYOUT = unchecked((int)0x80040206), /// The caller does not have the necessary type of document. TF_E_NOLOCK = unchecked((int)0x80040201), /// No embedded object exists at the specified position. TF_E_NOOBJECT = unchecked((int)0x80040202), /// No function provider exists for the specified function. TF_E_NOPROVIDER = unchecked((int)0x80040503), /// No selection exists within the context. TF_E_NOSELECTION = unchecked((int)0x80040205), /// The specified service does not exists or cannot be created. TF_E_NOSERVICE = unchecked((int)0x80040203), /// The TSF manager does not own the range. TF_E_NOTOWNEDRANGE = unchecked((int)0x80040502), /// The range is not within an active composition. TF_E_RANGE_NOT_COVERED = unchecked((int)0x80040507), /// The edit context is read-only. TF_E_READONLY = unchecked((int)0x80040209), /// The context stack is full. TF_E_STACKFULL = unchecked((int)0x80040501), /// A synchronous read-only lock cannot be obtained. TF_E_SYNCHRONOUS = unchecked((int)0x80040208), /// The data will be obtained asynchronously. TF_S_ASYNC = unchecked(0x00040300), } /// Flags for GetUpdatedFlags. [PInvokeData("msctf.h")] [Flags] public enum TF_CLUIE { /// The target document manager was changed. TF_CLUIE_DOCUMENTMGR = 0x00000001, /// The count of the candidate string was changed. TF_CLUIE_COUNT = 0x00000002, /// The selection of the candidate was changed. TF_CLUIE_SELECTION = 0x00000004, /// Some strings in the list were changed. TF_CLUIE_STRING = 0x00000008, /// The current page index or some page index was changed. TF_CLUIE_PAGEINDEX = 0x00000010, /// The page was changed. TF_CLUIE_CURRENTPAGE = 0x00000020, } /// /// The following flags are used as a value of GUID_COMPARTMENT_KEYBOARD_INPUTMODE_CONVERSION. This is equivalent with IME_CMODE /// values for IMM32. /// // https://docs.microsoft.com/en-us/windows/win32/tsf/flags-for-conversion-mode [PInvokeData("ctffunc.h")] [Flags] public enum TF_CONVERSIONMODE : uint { /// Set to 1 if ALPHANUMERIC mode. TF_CONVERSIONMODE_ALPHANUMERIC = 0x0000, /// Set to 1 if NATIVE mode; 0 if ALPHANUMERIC mode. TF_CONVERSIONMODE_NATIVE = 0x0001, /// Set to 1 if KATAKANA mode; 0 if HIRAGANA mode. TF_CONVERSIONMODE_KATAKANA = 0x0002, /// Set to 1 if full shape mode; 0 if half shape mode. TF_CONVERSIONMODE_FULLSHAPE = 0x0008, /// Set to 1 to prevent processing of conversions by IME; 0 if not. TF_CONVERSIONMODE_ROMAN = 0x0010, /// Set to 1 if character code input mode; 0 if not. TF_CONVERSIONMODE_CHARCODE = 0x0020, /// Set to 1 if Soft Keyboard mode; 0 if not. TF_CONVERSIONMODE_SOFTKEYBOARD = 0x0080, /// Set to 1 to prevent processing of conversions by IME; 0 if not. TF_CONVERSIONMODE_NOCONVERSION = 0x0100, /// Set to 1 if SYMBOL conversion mode; 0 if not. TF_CONVERSIONMODE_SYMBOL = 0x0400, /// Set to 1 if fixed conversion mode; 0 if not. TF_CONVERSIONMODE_FIXED = 0x0800, } /// /// Elements of the TF_DA_ATTR_INFO enumeration are used to specify text conversion data in the TF_DISPLAYATTRIBUTE structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ne-msctf-tf_da_attr_info [PInvokeData("msctf.h", MSDNShortId = "NE:msctf.__MIDL___MIDL_itf_msctf_0000_0070_0004")] [Guid("33D2FE4B-6C24-4F67-8D75-3BC1819E4126")] public enum TF_DA_ATTR_INFO { /// The text is entered by the user and has not been converted yet. TF_ATTR_INPUT, /// The user has made a character selection and the text has been converted yet. TF_ATTR_TARGET_CONVERTED, /// The text is converted. TF_ATTR_CONVERTED, /// The user made a character selection, but the text is not converted yet. TF_ATTR_TARGET_NOTCONVERTED, /// The text is an error character and cannot be converted. For example, some consonants cannot be put together. TF_ATTR_INPUT_ERROR, /// The text is not converted. Theses characters will no longer be converted. TF_ATTR_FIXEDCONVERTED, /// Reserved for the system. TF_ATTR_OTHER = -1, } /// /// Elements of the TF_DA_COLORTYPE enumeration specify the format of the color contained in the TF_DA_COLOR structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ne-msctf-tf_da_colortype [PInvokeData("msctf.h", MSDNShortId = "NE:msctf.__MIDL___MIDL_itf_msctf_0000_0070_0002")] [Guid("D9B92E21-084A-401B-9C64-1E6DAD91A1AB")] public enum TF_DA_COLORTYPE { /// The structure contains no color data. TF_CT_NONE, /// The color is specified as a system color index. For more information about the system color indexes, see GetSysColor. TF_CT_SYSCOLOR, /// The color is specified as an RGB value. TF_CT_COLORREF, } /// /// Elements of the TF_DA_LINESTYLE enumeration specify the underline style of a display attribute in the TF_DA_COLOR structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ne-msctf-tf_da_linestyle [PInvokeData("msctf.h", MSDNShortId = "NE:msctf.__MIDL___MIDL_itf_msctf_0000_0070_0001")] [Guid("C4CC07F1-80CC-4A7B-BC54-98512782CBE3")] public enum TF_DA_LINESTYLE { /// The text is not underlined. TF_LS_NONE, /// The text is underlined with a solid line. TF_LS_SOLID, /// The text is underlined with a dotted line. TF_LS_DOT, /// The text is underlined with a dashed line. TF_LS_DASH, /// The text is underlined with a solid wavy line. TF_LS_SQUIGGLE, } /// Speech recognition text service flags. [PInvokeData("msctf.h")] [Flags] public enum TF_DISABLE { /// /// If this bit is 1, speech input is disabled. Otherwise, speech input is enabled. Used with the /// GUID_COMPARTMENT_SPEECH_DISABLED compartment. /// TF_DISABLE_SPEECH = 0x00000001, /// /// If this bit is 1, speech dictation is disabled. Otherwise, speech dictation is enabled. Used with the /// GUID_COMPARTMENT_SPEECH_DISABLED compartment. /// TF_DISABLE_DICTATION = 0x00000002, /// /// If this bit is 1, speech command is disabled. Otherwise, speech command is enabled. Used with the /// GUID_COMPARTMENT_SPEECH_DISABLED compartment. /// TF_DISABLE_COMMANDING = 0x00000004, } /// The following are constants used by the ITfContext::RequestEditSession method. // https://docs.microsoft.com/en-us/windows/win32/tsf/tf-es--constants [PInvokeData("msctf.h")] [Flags] public enum TF_ES : uint { /// /// The edit session can occur synchronously or asynchronously, at the discretion of the manager. The manager will attempt to /// schedule a synchronous edit session for improved performance. This value cannot be combined with the TF_ES_ASYNC or /// TF_ES_SYNC values. /// TF_ES_ASYNCDONTCARE = 0x0, /// /// The edit session must be synchronous or the request will fail (with TF_E_SYNCHRONOUS). This flag should only be used in /// documented situations (such as keystroke handling) where it can be expected to succeed. Otherwise the call will likely fail. /// This value cannot be combined with the TF_ES_ASYNCDONTCARE or TF_ES_ASYNC values. /// TF_ES_SYNC = 0x1, /// Requests read-only access to the context. TF_ES_READ = 0x2, /// Requests write-only access to the context. TF_ES_WRITE = 0x4, /// Requests read/write access to the context. TF_ES_READWRITE = TF_ES_READ | TF_ES_WRITE, /// /// The edit session must be asynchronous or the request will fail. This value cannot be combined with the TF_ES_ASYNCDONTCARE /// or TF_ES_SYNC values. /// TF_ES_ASYNC = 0x8 } /// Miscellaneous framework constants indicate settings for clients, processes, or text. [PInvokeData("msctf.h")] [Flags] public enum TF_GTP : uint { /// /// Specifies that the ITfEditRecord::GetTextAndPropertyUpdates method will obtain the collection of range objects that cover /// the text changed during the edit session. /// TF_GTP_INCL_TEXT = 1, } /// Miscellaneous framework constants indicate settings for clients, processes, or text. [PInvokeData("msctf.h")] [Flags] public enum TF_HF : uint { /// The range shift stops if an embedded object is encountered. Used in dwFlags member of TF_HALTCOND structure. TF_HF_OBJECT = 1, } /// /// Specifies whether the pacpStart and pacpEnd parameters and the TS_TEXTCHANGE structure contain the results of the text insertion. /// [PInvokeData("msctf.h")] [Flags] public enum TF_IAS : uint { /// /// Text insertion will occur, and the pacpStart and pacpEnd parameters will contain the results of the text insertion. The /// TS_TEXTCHANGE structure must be filled with this flag. /// TF_IAS_NONE = 0, /// /// Text is inserted, the values of the pacpStart and pacpEnd parameters can be NULL, and the TS_TEXTCHANGE structure must be /// filled. Use this flag to view the results of the text insertion. /// TF_IAS_NOQUERY = 0x1, /// /// Text is not inserted, and the values for the pacpStart and pacpEnd parameters contain the results of the text insertion. The /// values of these parameters depend on how the application implements text insertion into a document. For more information, /// see the Remarks section. Use this flag to view the results of the text insertion without actually inserting the text. It is /// not required that you fill the TS_TEXTCHANGE structure if you use this flag. /// TF_IAS_QUERYONLY = 0x2, /// Caller takes responsibility for starting a composition over the range TF_IAS_NO_DEFAULT_COMPOSITION = 0x80000000, } /// Miscellaneous framework constants indicate settings for clients, processes, or text. [PInvokeData("msctf.h")] [Flags] public enum TF_IE : uint { /// /// The text is a transform (correction) of existing content, so that other text services can preserve data associated with the /// original text. Used in dwFlags parameter of ITfRange::InsertEmbedded. /// TF_IE_CORRECTION = 1, } /// The flag to specify the capability of text service. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_inputprocessorprofile [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_INPUTPROCESSORPROFILE")] [Flags] public enum TF_IPP_CAPS : uint { /// This text service profile is disabled on transitory context. TF_IPP_CAPS_DISABLEONTRANSITORY = 0x00000001, /// This text service supports the secure mode. This is categorized in GUID_TFCAT_TIPCAP_SECUREMODE. TF_IPP_CAPS_SECUREMODESUPPORT = 0x00000002, /// This text service supports the UIElement. This is categorized in GUID_TFCAT_TIPCAP_UIELEMENTENABLED. TF_IPP_CAPS_UIELEMENTENABLED = 0x00000004, /// This text service can be activated without COM. This is categorized in GUID_TFCAT_TIPCAP_COMLESS. TF_IPP_CAPS_COMLESSSUPPORT = 0x00000008, /// This text service can be activated on 16bit task. This is categorized in GUID_TFCAT_TIPCAP_WOW16. TF_IPP_CAPS_WOW16SUPPORT = 0x00000010, /// Starting with Windows 8: This text service has been tested to run properly in a Windows Store app. TF_IPP_CAPS_IMMERSIVESUPPORT = 0x00010000, /// /// Starting with Windows 8: This text service supports inclusion in the System Tray. This is used for text services that do not /// set the TF_IPP_CAPS_IMMERSIVESUPPORT flag but are still compatible with the System Tray. /// TF_IPP_CAPS_SYSTRAYSUPPORT = 0x00020000, } /// The flag for this profile. [PInvokeData("msctf.h")] [Flags] public enum TF_IPP_FLAG : uint { /// This profile is now active. TF_IPP_FLAG_ACTIVE = 0x00000001, /// This profile is enabled. TF_IPP_FLAG_ENABLED = 0x00000002, /// This profile is substituted by a text service. TF_IPP_FLAG_SUBSTITUTEDBYINPUTPROCESSOR = 0x00000004, } /// [PInvokeData("msctf.h")] [Flags] public enum TF_IPPMF : uint { /// Activate this profile for all threads in the process. TF_IPPMF_FORPROCESS = 0x10000000, /// Activate this profile for all threads in the current desktop. TF_IPPMF_FORSESSION = 0x20000000, /// TF_IPPMF_FORSYSTEMALL = 0x40000000, /// Update the registry to enable this profile for this user. TF_IPPMF_ENABLEPROFILE = 0x00000001, /// TF_IPPMF_DISABLEPROFILE = 0x00000002, /// /// If the current input language does not match with the requested profile's language, TSF marks this profile to be activated /// when the requested input language is switched. If this flag is off and the current input language is not matched, this /// method fails. /// TF_IPPMF_DONTCARECURRENTINPUTLANGUAGE = 0x00000004, } /// Flags for ITfInputProcessorProfileActivationSink::OnActivated. [PInvokeData("msctf.h")] [Flags] public enum TF_IPSINK_FLAG : uint { /// This is on if this profile is activated. TF_IPSINK_FLAG_ACTIVE = 0x0001, } /// The TF_MOD_* constants specify key modifiers in the TF_PRESERVEDKEY structure. // https://docs.microsoft.com/en-us/windows/win32/tsf/tf-mod--constants [PInvokeData("msctf.h")] [Flags] public enum TF_MOD : uint { /// Either of the ALT keys is pressed TF_MOD_ALT = 0x0001, /// Either of the CTRL keys is pressed TF_MOD_CONTROL = 0x0002, /// Either of the SHIFT keys is pressed TF_MOD_SHIFT = 0x0004, /// The right ALT key is pressed TF_MOD_RALT = 0x0008, /// The right CTRL key is pressed TF_MOD_RCONTROL = 0x0010, /// The right SHIFT key is pressed TF_MOD_RSHIFT = 0x0020, /// The left ALT key is pressed TF_MOD_LALT = 0x0040, /// The left CTRL key is pressed TF_MOD_LCONTROL = 0x0080, /// The left SHIFT key is pressed TF_MOD_LSHIFT = 0x0100, /// The event will be fired when the key is released. Without this flag, the event is fired when the key is pressed. TF_MOD_ON_KEYUP = 0x0200, /// /// The state of the ALT, CTRL, and SHIFT keys is ignored. This means the event will be fired when the virtual key is pressed, /// regardless of which modifier keys are pressed. /// TF_MOD_IGNORE_ALL_MODIFIER = 0x0400, } /// Flags for . // https://docs.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itfdocumentmgr-pop [PInvokeData("msctf.h")] [Flags] public enum TF_POPF : uint { /// All of the contexts are removed from the stack. TF_POPF_ALL = 0x1 } /// Used by TF_INPUTPROCESSORPROFILE. [PInvokeData("msctf.h")] [Flags] public enum TF_PROFILETYPE : uint { /// This is a text service. TF_PROFILETYPE_INPUTPROCESSOR = 0x0001, /// This is a keyboard layout. TF_PROFILETYPE_KEYBOARDLAYOUT = 0x0002, } /// Used by ITfReverseConversionMgr::GetReverseConversion. [PInvokeData("msctf.h")] [Flags] public enum TF_RCM : uint { /// Activate the reverse conversion interface without COM. TF_RCM_COMLESS = 0x00000001, /// The output should be an array of virtual key codes (instead of chracter key codes). TF_RCM_VKEY = 0x00000002, /// /// The reverse conversion should prioritize the order of entries in the output list based on the length of input sequence, with /// the shortest sequences first. It is possible that an input sequence with a low collision count might be much higher than an /// input sequence with a similar (but slightly higher) collision count. The interpretation of this flag varies depending on the IME. /// TF_RCM_HINT_READING_LENGTH = 0x00000004, /// /// The reverse conversion should prioritize the order of entries in the output list based on the collision count, with the /// entries containing the lowest number of collisions first. If an input sequence corresponds to many more characters than a /// slightly longer input sequence, it might be preferable to use the longer input sequence instead. The IME determines whether /// this flag will affect the reverse conversion output. /// TF_RCM_HINT_COLLISION = 0x00000008, } /// Used by ITfInputProcessorProfileMgr::ReleaseInputProcessor. [PInvokeData("msctf.h")] [Flags] public enum TF_RIP_FLAG : uint { /// /// If this bit is on, this method calls CoFreeUnusedLibrariesEx() so the text services DLL might be freed if it does not have /// any more COM/DLL reference. Warning: This flag could cause some other unrelated COM/DLL free. /// TF_RIP_FLAG_FREEUNUSEDLIBRARIES = 0x00000001, } /// Used by ITfReadingInformationUIElement::GetUpdatedFlags [PInvokeData("msctf.h")] [Flags] public enum TF_RIUIE : uint { /// The target ITfContext was changed. TF_RIUIE_CONTEXT = 0x00000001, /// The reading information string was changed. TF_RIUIE_STRING = 0x00000002, /// The max length of the reading information string was changed. TF_RIUIE_MAXREADINGSTRINGLENGTH = 0x00000004, /// The error index of the reading information string was changed. TF_RIUIE_ERRORINDEX = 0x00000008, /// The vertical order preference was changed. TF_RIUIE_VERTICALORDER = 0x00000010, } /// Used by ITfInputProcessorProfileMgr::RegisterProfile. [PInvokeData("msctf.h")] [Flags] public enum TF_RP : uint { /// This profile will not appear in the setting UI. TF_RP_HIDDENINSETTINGUI = 0x00000002, /// This profile is available only on the local process. TF_RP_LOCALPROCESS = 0x00000004, /// This profile is available only on the local thread. TF_RP_LOCALTHREAD = 0x00000008, /// TF_RP_SUBITEMINSETTINGUI = 0x00000010, } /// /// The following values are used as a value of GUID_COMPARTMENT_KEYBOARD_INPUTMODE_SENTENCE. This is equivalent with IME_SMODE /// values for IMM32. /// // https://docs.microsoft.com/en-us/windows/win32/tsf/flags-for-conversion-mode [PInvokeData("msctf.h")] [Flags] public enum TF_SENTENCEMODE : uint { /// No information for sentence. TF_SENTENCEMODE_NONE = 0x0000, /// The IME uses plural clause information to carry out conversion processing. TF_SENTENCEMODE_PLAURALCLAUSE = 0x0001, /// The IME carries out conversion processing in single-character mode. TF_SENTENCEMODE_SINGLECONVERT = 0x0002, /// The IME carries out conversion processing in automatic mode. TF_SENTENCEMODE_AUTOMATIC = 0x0004, /// The IME uses phrase information to predict the next character. TF_SENTENCEMODE_PHRASEPREDICT = 0x0008, /// The IME uses conversation mode. This is useful for chat applications. TF_SENTENCEMODE_CONVERSATION = 0x0010, } /// Used in dwFlags parameter of ITfRange::SetText. [PInvokeData("msctf.h")] [Flags] public enum TF_ST : uint { /// /// The text is a transform (correction) of existing content, so that other text services can preserve data associated with the /// original text. Used in dwFlags parameter of ITfRange::SetText. /// TF_ST_CORRECTION = 1, } /// The TF_TF_* constants are used to specify options with the ITfRange::GetText method. // https://docs.microsoft.com/en-us/windows/win32/tsf/tf-tf--constants [PInvokeData("msctf.h")] [Flags] public enum TF_TF : uint { /// Update start anchor. TF_TF_MOVESTART = 1, /// Ignore end anchor. TF_TF_IGNOREEND = 2, } /// Flags for ITfThreadMgr2::ActivateEx and ITfTextInputProcessorEx::ActivateEx. [PInvokeData("msctf.h")] [Flags] public enum TF_TMAE : uint { /// /// Text services will not be activated while this method is called. They will be activated when the calling thread has focus asynchronously. /// TF_TMAE_NOACTIVATETIP = 0x00000001, /// TSF is activated in secure mode. Only text services that support the secure mode will be activated. TF_TMAE_SECUREMODE = 0x00000002, /// TSF activates only text services that are categorized in GUID_TFCAT_TIPCAP_UIELEMENTENABLED. TF_TMAE_UIELEMENTENABLEDONLY = 0x00000004, /// TSF does not use COM. TSF activate only text services that are categorized in GUID_TFCAT_TIPCAP_COMLESS. TF_TMAE_COMLESS = 0x00000008, /// The current thread is 16 bit task. TF_TMAE_WOW16 = 0x00000010, /// /// TSF does not sync the current keyboard layout while this method is called. The keyboard layout will be adjusted when the /// calling thread gets focus. This flag must be used with TF_TMAE_NOACTIVATETIP. /// TF_TMAE_NOACTIVATEKEYBOARDLAYOUT = 0x00000020, /// A text service is activated for console usage. TF_TMAE_CONSOLE = 0x00000040, } /// Flags for ITfThreadMgr2::GetActiveFlags. [PInvokeData("msctf.h")] [Flags] public enum TF_TMF : uint { /// TSF was activated with the TF_TMAE_NOACTIVATETIP flag. TF_TMF_NOACTIVATETIP = TF_TMAE.TF_TMAE_NOACTIVATETIP, /// TSF is running in secure mode. TF_TMF_SECUREMODE = TF_TMAE.TF_TMAE_SECUREMODE, /// TSF is running with text services that support only UIElement. TF_TMF_UIELEMENTENABLEDONLY = TF_TMAE.TF_TMAE_UIELEMENTENABLEDONLY, /// TSF is running without COM. TF_TMF_COMLESS = TF_TMAE.TF_TMAE_COMLESS, /// TSF is running in 16 bit task. TF_TMF_WOW16 = TF_TMAE.TF_TMAE_WOW16, /// TSF is running for console usage. TF_TMF_CONSOLE = TF_TMAE.TF_TMAE_CONSOLE, /// TSF is active in a Windows Store app. TF_TMF_IMMERSIVEMODE = 0x40000000, /// TSF is active. TF_TMF_ACTIVATED = 0x80000000, } /// /// The following values of the GUID_COMPARTMENT_TRANSITORYEXTENSION compartment are used to control the behavior of transitory extension. /// // https://docs.microsoft.com/en-us/windows/win32/tsf/values-for-guid-compartment-transitoryextension [PInvokeData("msctf.h")] [Flags] public enum TF_TRANSITORYEXTENSION : uint { /// This value stops the transitory extension. TF_TRANSITORYEXTENSION_NONE = 0x0000, /// This value starts the transitory extension with the floating UI. TF_TRANSITORYEXTENSION_FLOATING = 0x0001, /// /// This value starts the transitory extension with the popup UI at the IP or the selection of the parent document manager. /// TF_TRANSITORYEXTENSION_ATSELECTION = 0x0002, } /// Used in dwFlags parameter of ITfPropertyStore::OnTextUpdated. [PInvokeData("msctf.h")] [Flags] public enum TF_TU : uint { /// /// The text change is the result of a transform (correction) of existing content. This implies that the semantics of the text /// have not changed. /// TF_TU_CORRECTION = 0x1, } /// Flags used by ITfInputProcessorProfileMgr::UnregisterProfile. [PInvokeData("msctf.h")] [Flags] public enum TF_URP : uint { /// /// If this bit is on, UnregistrProfile unregisters all profiles of the rclsid parameter. The langid and guidProfile parameters /// are ignored. /// TF_URP_ALLPROFILES = 0x00000002, /// The profile was registered on the local process. TF_URP_LOCALPROCESS = 0x00000004, /// The profile was registered on the local thread. TF_URP_LOCALTHREAD = 0x00000008, } /// Elements of the TfActiveSelEnd enumeration specify which end of a selected range of text is active. /// /// /// The active end of a selected range is the end likely to respond to user actions. For example, in many applications, holding the /// SHIFT key down while using the arrow keys will change the selected range. The end of the selected range that moves is the active /// end of the selected range. /// /// This enumeration is used in the TF_SELECTIONSTYLE structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ne-msctf-tfactiveselend [PInvokeData("msctf.h", MSDNShortId = "NE:msctf.__MIDL_ITfContext_0001")] [Guid("1690BE9B-D3E9-49F6-8D8B-51B905AF4C43")] public enum TfActiveSelEnd : uint { /// The selected range has no active end. This is typical for selected ranges other than the default selected range. TF_AE_NONE, /// The active end is at the start of the selected range. TF_AE_START, /// The active end is at the end of the selected range. TF_AE_END, } /// Elements of the TfAnchor enumeration specify the start anchor or end anchor of an ITfRange object. /// A range refers to a span of text in a document. Each range is delimited by a start anchor and an end anchor. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ne-msctf-tfanchor [PInvokeData("msctf.h", MSDNShortId = "NE:msctf.__MIDL___MIDL_itf_msctf_0000_0000_0001")] [Guid("5A886226-AE9A-489B-B991-2B1E25EE59A9")] public enum TfAnchor : uint { /// Specifies the start anchor of the ITfRange object. TF_ANCHOR_START, /// Specifies the end anchor of the ITfRange object. TF_ANCHOR_END, } /// /// Elements of the TfGravity enumeration specify the type of gravity associated with the anchor of an ITfRange object. /// /// For more information about anchor gravity, see Anchor Gravity. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ne-msctf-tfgravity [PInvokeData("msctf.h", MSDNShortId = "NE:msctf.__MIDL_ITfRange_0001")] [Guid("CF610F06-2882-46F6-ABE5-298568B664C4")] public enum TfGravity : uint { /// The anchor has backward gravity. TF_GRAVITY_BACKWARD, /// The anchor has forward gravity. TF_GRAVITY_FORWARD, } /// /// Elements of the TfLayoutCode enumeration specify the type of layout change in an ITfTextLayoutSink::OnLayoutChange notification. /// /// /// In TSF, a view is on-screen rendering of document content. These constants are assigned to parameters of methods of the /// ITf* interfaces, but not those of the IText* interfaces. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ne-msctf-tflayoutcode [PInvokeData("msctf.h", MSDNShortId = "NE:msctf.__MIDL_ITfTextLayoutSink_0001")] [Guid("603553CF-9EDD-4CC1-9ECC-069E4A427734")] public enum TfLayoutCode : uint { /// The view has just been created. TF_LC_CREATE, /// The view layout has changed. TF_LC_CHANGE, /// The view is about to be destroyed. TF_LC_DESTROY, } /// Elements of the TfShiftDir enumeration specify which direction a range anchor is moved. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ne-msctf-tfshiftdir [PInvokeData("msctf.h", MSDNShortId = "NE:msctf.__MIDL_ITfRange_0002")] [Guid("1E512533-BBDC-4530-9A8E-A1DC0AF67468")] public enum TfShiftDir : uint { /// Specifies that the anchor will be moved to the region immediately preceding the range. TF_SD_BACKWARD, /// Specifies that the anchor will be moved to the region immediately following the range. TF_SD_FORWARD, } /// The following values identify TSF-defined properties. The data format and contents of each property type are included. // https://docs.microsoft.com/en-us/windows/win32/tsf/predefined-properties [PInvokeData("msctf.h")] public enum TKB_ALTERNATES : uint { /// /// Indicates that the touch keyboard has generated a list of possible alternate words for the text in the range covered by the /// property, and that neither the text range nor the alternates are an autocorrection or a text suggestion. /// TKB_ALTERNATES_STANDARD = 0x00000001, /// /// Indicates that the touch keyboard has generated an alternate word which should automatically replace the text in the text /// range covered by the property. /// /// The touch keyboard will not apply the autocorrection without being instructed to do so by the edit control or app. The /// reconversion interface (ITfFnReconversion) should be used to apply the correction to the text in the document. /// /// TKB_ALTERNATES_FOR_AUTOCORRECTION = 0x00000002, /// /// Indicates that the text range covered by the property is a text suggestion that has been generated by the touch keyboard and /// inserted into the document by the user. /// Additional alternate predictions can also be stored as a property in the document. /// TKB_ALTERNATES_FOR_PREDICTION = 0x00000003, /// /// Indicates that the text range covered by the property is an autocorrection provided by the touch keyboard and applied via /// the ITfFnReconversion interface. /// /// This value can be used by edit controls or apps, with TKB_ALTERNATES_FOR_AUTOCORRECTION, to prevent the repeated application /// of an autocorrection. /// /// TKB_ALTERNATES_AUTOCORRECTION_APPLIED = 0x00000004, } /// The TF_DA_COLOR structure contains color data used in the display attributes for a range of text. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_da_color typedef struct TF_DA_COLOR { TF_DA_COLORTYPE type; // union { int nIndex; COLORREF cr; }; } TF_DA_COLOR; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_DA_COLOR")] [StructLayout(LayoutKind.Explicit, Pack = 4), Guid("90D0CB5E-6520-4A0F-B47C-C39BD955F0D6")] public struct TF_DA_COLOR { /// Specifies the color type as defined in the TF_DA_COLORTYPE enumeration. [FieldOffset(0)] internal TF_DA_COLORTYPE type; /// /// Specifies the color as a system color index as defined in GetSysColor. This member is used only if type is equal to TF_CT_SYSCOLOR. /// [FieldOffset(4)] internal int nIndex; /// Specifies the color as an RGB value. This member is used only if type is equal to TF_CT_COLORREF. [FieldOffset(4)] internal COLORREF cr; } /// The TF_DISPLAYATTRIBUTE structure contains display attribute data for rendering text. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_displayattribute typedef struct TF_DISPLAYATTRIBUTE { // TF_DA_COLOR crText; TF_DA_COLOR crBk; TF_DA_LINESTYLE lsStyle; BOOL fBoldLine; TF_DA_COLOR crLine; TF_DA_ATTR_INFO bAttr; } TF_DISPLAYATTRIBUTE; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_DISPLAYATTRIBUTE")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("1BF1C305-419B-4182-A4D2-9BFADC3F021F")] public struct TF_DISPLAYATTRIBUTE { /// Contains a TF_DA_COLOR structure that defines the text foreground color. public TF_DA_COLOR crText; /// Contains a TF_DA_COLOR structure that defines the text background color. public TF_DA_COLOR crBk; /// Contains a TF_DA_LINESTYLE enumeration value that defines the underline style. public TF_DA_LINESTYLE lsStyle; /// /// A BOOL value that specifies if the underline should be bold or normal weight. If this value is nonzero, the underline should /// be bold. If this value is zero, the underline should be normal. /// [MarshalAs(UnmanagedType.Bool)] public bool fBoldLine; /// Contains a TF_DA_COLOR structure that defines the color of the underline. public TF_DA_COLOR crLine; /// Contains a TF_DA_ATTR_INFO value that defines text conversion display attribute data. public TF_DA_ATTR_INFO bAttr; } /// This structure contains data for the input processor profile. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_inputprocessorprofile typedef struct // TF_INPUTPROCESSORPROFILE { DWORD dwProfileType; LANGID langid; CLSID clsid; GUID guidProfile; GUID catid; HKL hklSubstitute; // DWORD dwCaps; HKL hkl; DWORD dwFlags; } TF_INPUTPROCESSORPROFILE; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_INPUTPROCESSORPROFILE")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("44D2825A-10E5-43B2-877F-6CB2F43B7E7E")] public struct TF_INPUTPROCESSORPROFILE { /// /// The type of this profile. This is one of these values. /// /// /// Value /// Meaning /// /// /// TF_PROFILETYPE_INPUTPROCESSOR /// This is a text service. /// /// /// TF_PROFILETYPE_KEYBOARDLAYOUT /// This is a keyboard layout. /// /// /// public TF_PROFILETYPE dwProfileType; /// The language id for this profile. public LANGID langid; /// The CLSID of the text service. This is CLSID_NULL if this profile is a keyboard layout. public Guid clsid; /// The guidProfile of the text services. This is GUID_NULL if this profile is a keyboard layout. public Guid guidProfile; /// /// The category of this text service. This category is GUID_TFCAT_TIP_KEYBOARD, GUID_TFCAT_TIP_SPEECH, /// GUID_TFCAT_TIP_HANDWRITING or something in GUID_TFCAT_CATEGORY_OF_TIP. /// public Guid catid; /// /// The keyboard layout handle of the substitute for this text service. This can be NULL if the text service does not /// have a substitute or this profile is a keyboard layout. /// public HKL hklSubstitute; /// /// The flag to specify the capability of text service. This is the combination of the following flags: /// /// /// Value /// Meaning /// /// /// TF_IPP_CAPS_DISABLEONTRANSITORY /// This text service profile is disabled on transitory context. /// /// /// TF_IPP_CAPS_SECUREMODESUPPORT /// This text service supports the secure mode. This is categorized in GUID_TFCAT_TIPCAP_SECUREMODE. /// /// /// TF_IPP_CAPS_UIELEMENTENABLED /// This text service supports the UIElement. This is categorized in GUID_TFCAT_TIPCAP_UIELEMENTENABLED. /// /// /// TF_IPP_CAPS_COMLESSSUPPORT /// This text service can be activated without COM. This is categorized in GUID_TFCAT_TIPCAP_COMLESS. /// /// /// TF_IPP_CAPS_WOW16SUPPORT /// This text service can be activated on 16bit task. This is categorized in GUID_TFCAT_TIPCAP_WOW16. /// /// /// TF_IPP_CAPS_IMMERSIVESUPPORT /// Starting with Windows 8: This text service has been tested to run properly in a Windows Store app. /// /// /// TF_IPP_CAPS_SYSTRAYSUPPORT /// /// Starting with Windows 8: This text service supports inclusion in the System Tray. This is used for text services that do not /// set the TF_IPP_CAPS_IMMERSIVESUPPORT flag but are still compatible with the System Tray. /// /// /// /// public TF_IPP_CAPS dwCaps; /// The keyboard layout handle. This is NULL if this profile is a text service. public HKL hkl; /// /// The flag for this profile. This is a combination of the following flags: /// /// /// Value /// Meaning /// /// /// TF_IPP_FLAG_ACTIVE /// This profile is now active. /// /// /// TF_IPP_FLAG_ENABLED /// This profile is enabled. /// /// /// TF_IPP_FLAG_SUBSTITUTEDBYINPUTPROCESSOR /// This profile is substituted by a text service. /// /// /// public TF_IPP_FLAG dwFlags; } /// The TF_LANGUAGEPROFILE structure contains information about a language profile. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_languageprofile typedef struct TF_LANGUAGEPROFILE { CLSID // clsid; LANGID langid; GUID catid; BOOL fActive; GUID guidProfile; } TF_LANGUAGEPROFILE; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_LANGUAGEPROFILE")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("E1B5808D-1E46-4C19-84DC-68C5F5978CC8")] public struct TF_LANGUAGEPROFILE { /// Specifies the class identifier of the text service within the language profile. public Guid clsid; /// Specifies the language identifier of the profile. public LANGID langid; /// Specifies the identifier of the category that the text service belongs to. public Guid catid; /// A Boolean value, when TRUE, indicates that the language is activated. [MarshalAs(UnmanagedType.Bool)] public bool fActive; /// Specifies the identifier of the language profile. public Guid guidProfile; } /// The TF_PERSISTENT_PROPERTY_HEADER_ACP structure is used to provide property header data. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_persistent_property_header_acp typedef struct // TF_PERSISTENT_PROPERTY_HEADER_ACP { GUID guidType; LONG ichStart; LONG cch; ULONG cb; DWORD dwPrivate; CLSID clsidTIP; } TF_PERSISTENT_PROPERTY_HEADER_ACP; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_PERSISTENT_PROPERTY_HEADER_ACP")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("E26D9E1D-691E-4F29-90D7-338DCF1F8CEF")] public struct TF_PERSISTENT_PROPERTY_HEADER_ACP { /// Contains a GUID that identifies the property. public Guid guidType; /// Contains the starting character position of the property. public int ichStart; /// Contains the number of characters that the property spans. public int cch; /// Contains the size, in bytes, of the property value. public uint cb; /// Contains a DWORD value defined by the property owner. public uint dwPrivate; /// Contains the CLSID of the property owner. public Guid clsidTIP; } /// The TF_PRESERVEDKEY structure represents a preserved key. /// /// Preserved keys are registered by TSF text services and provide keyboard shortcuts to common commands implemented by the TSF text service. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_preservedkey typedef struct TF_PRESERVEDKEY { UINT uVKey; // UINT uModifiers; } TF_PRESERVEDKEY; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_PRESERVEDKEY")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("77C12F95-B783-450D-879F-1CD2362C6521")] public struct TF_PRESERVEDKEY { /// Virtual key code of the keyboard shortcut. public uint uVKey; /// Modifies the preserved key. This can be zero or a combination of one or more of the TF_MOD_* constants. public TF_MOD uModifiers; } /// /// The TF_PROPERTYVAL structure contains property value data. This structure is used with the IEnumTfPropertyValue::Next method. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_propertyval typedef struct TF_PROPERTYVAL { GUID guidId; // VARIANT varValue; } TF_PROPERTYVAL; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_PROPERTYVAL")] [StructLayout(LayoutKind.Sequential, Pack = 8), Guid("D678C645-EB6A-45C9-B4EE-0F3E3A991348")] public struct TF_PROPERTYVAL { /// /// A GUID that identifies the property type. This can be a custom identifier or one of the predefined property identifiers. /// public Guid guidId; /// /// A VARIANT that contains the value of the property specified by guidId. The user must know the type and format /// of this data. /// [MarshalAs(UnmanagedType.Struct)] public object varValue; } /// The TF_SELECTION structure contains text selection data. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_selection typedef struct TF_SELECTION { ITfRange *range; // TF_SELECTIONSTYLE style; } TF_SELECTION; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_SELECTION")] [StructLayout(LayoutKind.Sequential)] public struct TF_SELECTION { /// Pointer to an ITfRange object that specifies the selected text. public ITfRange range; /// A TF_SELECTIONSTYLE structure that contains selection data. public TF_SELECTIONSTYLE style; } /// The TF_SELECTIONSTYLE structure represents the style of a selection. /// /// An interim character selection spans exactly one character and is visually represented as a solid rectangle that is usually /// flashing. This is a standard UI element of Korean and some Chinese character compositions. fInterimChar is an indication /// that a specific character is composed. fInterimChar can only be nonzero for a single selection. In this case, there will /// be no caret because the highlight replaces it. /// // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_selectionstyle typedef struct TF_SELECTIONSTYLE { // TfActiveSelEnd ase; BOOL fInterimChar; } TF_SELECTIONSTYLE; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_SELECTIONSTYLE")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("36AE42A4-6989-4BDC-B48A-6137B7BF2E42")] public struct TF_SELECTIONSTYLE { /// Specifies the active end of the selection. For more information, see TfActiveSelEnd. public TfActiveSelEnd ase; /// /// Indicates if the selection is an interim character. If this value is nonzero, then the seleciton is an interim character and /// ase will be TF_AE_NONE. If this value is zero, the selection is not an interim character. /// [MarshalAs(UnmanagedType.Bool)] public bool fInterimChar; } /// The TF_HALTCOND structure is used to contain conditions of a range shift. // https://docs.microsoft.com/en-us/windows/win32/api/msctf/ns-msctf-tf_haltcond typedef struct TF_HALTCOND { ITfRange *pHaltRange; // TfAnchor aHaltPos; DWORD dwFlags; } TF_HALTCOND; [PInvokeData("msctf.h", MSDNShortId = "NS:msctf.TF_HALTCOND")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("49930D51-7D93-448C-A48C-FEA5DAC192B1")] public class TF_HALTCOND { /// /// Pointer to an ITfRange object that halts the shift. If the range shift encounters this range during the shift, the shift /// halts. This member can be NULL. /// public ITfRange pHaltRange; /// /// Contains one of the TfAnchor values that specifies which anchor of pHaltRange the anchor will get shifted to if /// pHaltRange is encountered during the range shift. This member is ignored if pHaltRange is NULL. /// public TfAnchor aHaltPos; /// /// Contains a set of flags that modify the behavior of the range shift. This can be zero or the following value. /// /// /// Value /// Meaning /// /// /// TF_HF_OBJECT /// The range shift halts if an embedded object is encountered. /// /// /// public TF_HF dwFlags; } } }