namespace Vanara.PInvoke; public static partial class Imm32 { /// ImePadApplet's Category ID version 14.0.0 public static readonly Guid CATID_MSIME_IImePadApplet = new(0x7566cad1, 0x4ec9, 0x4478, 0x9f, 0xe9, 0x8e, 0xd7, 0x66, 0x61, 0x9e, 0xdf); /// ImePadApplet's Category ID public static readonly Guid CATID_MSIME_IImePadApplet_VER7 = new(0x4a0f8e31, 0xc3ee, 0x11d1, 0xaf, 0xef, 0x0, 0x80, 0x5f, 0xc, 0x8b, 0x6d); /// ImePadApplet's Category ID version 8.0.0 public static readonly Guid CATID_MSIME_IImePadApplet_VER80 = new(0x56f7a792, 0xfef1, 0x11d3, 0x84, 0x63, 0x0, 0xc0, 0x4f, 0x7a, 0x6, 0xe5); /// ImePadApplet's Category ID version 8.1.0 public static readonly Guid CATID_MSIME_IImePadApplet_VER81 = new(0x656520b0, 0xbb88, 0x11d4, 0x84, 0xc0, 0x0, 0xc0, 0x4f, 0x7a, 0x6, 0xe5); /// ImePadApplet's Category ID version 10.0.0 public static readonly Guid CATID_MSIME_IImePadApplet1000 = new(0xe081e1d6, 0x2389, 0x43cb, 0xb6, 0x6f, 0x60, 0x9f, 0x82, 0x3d, 0x9f, 0x9c); /// ImePadApplet's Category ID version 12.0.0 public static readonly Guid CATID_MSIME_IImePadApplet1200 = new(0xa47fb5fc, 0x7d15, 0x4223, 0xa7, 0x89, 0xb7, 0x81, 0xbf, 0x9a, 0xe6, 0x67); /// ImePadApplet's Category ID version 9.0.0 public static readonly Guid CATID_MSIME_IImePadApplet900 = new(0xfaae51bf, 0x5e5b, 0x4a1d, 0x8d, 0xe1, 0x17, 0xc1, 0xd9, 0xe1, 0x72, 0x8d); private const int IMEPADREQ_FIRST = 0x1000; private const uint IMEPN_FIRST = 0x0100; /// IMECHARINFO's dwCharInfo bit mask [PInvokeData("imepad.h")] [Flags] public enum CHARINFO : uint { /// CHARINFO_APPLETID_MASK = 0xFF000000, /// CHARINFO_FEID_MASK = 0x00F00000, /// CHARINFO_CHARID_MASK = 0x0000FFFF, } /// Character Id in FarEast [PInvokeData("imepad.h")] public enum FEID { /// FEID_NONE = 0x00, /// FEID_CHINESE_TRADITIONAL = 0x01, /// FEID_CHINESE_SIMPLIFIED = 0x02, /// FEID_CHINESE_HONGKONG = 0x03, /// FEID_CHINESE_SINGAPORE = 0x04, /// FEID_JAPANESE = 0x05, /// FEID_KOREAN = 0x06, /// FEID_KOREAN_JOHAB = 0x07, } /// FarEast data type [PInvokeData("imepad.h")] public enum IMEFAREASTINFO_TYPE { /// IMEFAREASTINFO_TYPE_DEFAULT = 0, /// IMEFAREASTINFO_TYPE_READING = 1, /// IMEFAREASTINFO_TYPE_COMMENT = 2, /// IMEFAREASTINFO_TYPE_COSTTIME = 3, } /// The type of request (the request ID). [PInvokeData("imepad.h", MSDNShortId = "NN:imepad.IImePad")] public enum IMEPADREQ { /// /// Insert a string into the app as a composition string. /// wParam: Pointer to the NULL-terminated string (LPWSTR) to be inserted into the app. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_INSERTSTRING = IMEPADREQ_FIRST + 1, /// /// Controls composition of the string and caret in the app. /// /// wParam: Specifies the control value (IMEPADCTRL_*) that requests IME to process the composition string and caret position. See /// Remarks for a list of the IMEPADCTRL_* values. /// /// lParam: Not used. Must be set to 0. /// IMEPADREQ_SENDCONTROL = IMEPADREQ_FIRST + 4, /// /// Set a new applet window size. /// wParam: LOWORD(wParam) specifies the applet's width. HIWORD(wParam) specifies applet's height /// lParam: Not used. Must be set to 0. /// IMEPADREQ_SETAPPLETSIZE = IMEPADREQ_FIRST + 8, /// /// Gets the current composition string text. /// wParam: Points to the buffer (LPWSTR) that is to receive the current composition string text. /// lParam: The maximum number of characters to copy, including the terminating null character. /// IMEPADREQ_GETCOMPOSITIONSTRING = IMEPADREQ_FIRST + 6, /// /// Gets information about the current composition string. /// wParam: Pointer to a IMECOMPOSITIONSTRINGINFO structure that receives the composition information. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_GETCOMPOSITIONSTRINGINFO = IMEPADREQ_FIRST + 12, /// /// Delete the composition string. /// /// wParam: LOWORD(wParam) specifies the start position of the composition string to be deleted. HIWORD(wParam) specifies the length /// of the composition string to delete. /// /// lParam: Not used. Must be set to 0. /// IMEPADREQ_DELETESTRING = IMEPADREQ_FIRST + 16, /// /// Replace part of the composition string. /// wParam: Pointer to the replacement string (LPWSTR). /// /// lParam: LOWORD(lParam) specifies the start position of the composition string to be replaced. HIWORD(lParam) specifies the length /// of the composition string to be replaced. /// /// IMEPADREQ_CHANGESTRING = IMEPADREQ_FIRST + 17, /// /// Gets the application window handle. /// wParam: The HWND handle address (HWND *) to receive the application window handle. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_GETAPPLHWND = IMEPADREQ_FIRST + 20, /// /// Keeps the ImePad window visible. /// wParam: TRUE to keep the IMEPad window visible. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_FORCEIMEPADWINDOWSHOW = IMEPADREQ_FIRST + 21, /// /// Causes IImePad to call the applet's Notify method asynchronously with a specific notification Id and user-defined data. /// wParam: The notify code (IMEPN_*). See the Remarks for IImePadApplet::Notify for the possible IMEPN_* codes. /// lParam: User-defined data /// IMEPADREQ_POSTMODALNOTIFY = IMEPADREQ_FIRST + 22, /// /// Gets the recommended (default) ImePad applet UI Language. /// wParam: Address of Language ID (LANGID *) to receive the default UI Language. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_GETDEFAULTUILANGID = IMEPADREQ_FIRST + 23, /// /// Get the current ImePad applet UI Language. /// wParam: Address of Language ID (LANGID *) to receive the current UI Language. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_GETCURRENTUILANG = IMEPADREQ_FIRST + 24, /// /// Gets the applet's UI style (IPAWS_* flags). /// /// wParam: Address to receive the applet UI style (DWORD *). The style is a combination of IPAWS_* flags; see Remarks for the /// possible IPAWS_* flags. /// /// lParam: Not used. Must be set to 0. /// IMEPADREQ_GETAPPLETUISTYLE = IMEPADREQ_FIRST + 25, /// /// Sets the applet's UI style (IPAWS_* flags). /// wParam: Applet UI style. The style is a combination of IPAWS_* flags; see Remarks for the possible IPAWS_* flags. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_SETAPPLETUISTYLE = IMEPADREQ_FIRST + 26, /// /// Determines if the applet is active. /// wParam: Address to receive the value (BOOL *). If it's TRUE, the applet is active; otherwise the applet is not active. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_ISAPPLETACTIVE = IMEPADREQ_FIRST + 27, /// /// Determines if ImePad is visible. /// wParam: Address to receive the value (BOOL *). If it's TRUE, ImePad is visible; otherwise ImePad is not visible. /// lParam: Not used. Must be set to 0. /// IMEPADREQ_ISIMEPADWINDOWVISIBLE = IMEPADREQ_FIRST + 28, /// /// Set the minimum and maximum applet size. /// wParam: LOWORD(wParam) specifies the applet width. HIWORD(wParam) specifies the applet height. /// lParam: TRUE sets the maximum size; FALSE to sets the minimum size. /// IMEPADREQ_SETAPPLETMINMAXSIZE = IMEPADREQ_FIRST + 29, /// /// Gets the current application IME's conversion status. For a complete list of conversion and sentence modes, see the header file Imm.h. /// wParam: Address to receive the conversion mode (DWORD *). /// lParam: Address to receive the sentence mode (DWORD *). /// IMEPADREQ_GETCONVERSIONSTATUS = IMEPADREQ_FIRST + 30, /// /// Gets IImePad's version information. /// wParam: Address to receive Major version (DWORD *). /// lParam: Address to receive Minor version (DWORD *). /// IMEPADREQ_GETVERSION = IMEPADREQ_FIRST + 31, /// /// Gets the IME information that invoked ImePad. /// wParam: Address to receive the IME's language ID (DWORD *). /// lParam: Address to receive the IME's input ID (DWORD *). /// IMEPADREQ_GETCURRENTIMEINFO = IMEPADREQ_FIRST + 32, /// /// IMEPADREQ_INSERTSTRINGCANDIDATE /// wParam = (WPARAM)(LPIMESTRINGCANDIDATE)lpStrCand; //address of IMESTRINGCANDIDATE /// lParam = 0; //not used. /// IMEPADREQ_INSERTSTRINGCANDIDATE = IMEPADREQ_FIRST + 2, /// /// IMEPADREQ_INSERTITEMCANDIDATE /// Not implemented in version 7.1.0 /// wParam = 0; /// IMEPADREQ_INSERTITEMCANDIDATE = IMEPADREQ_FIRST + 3, /// /// IMEPADREQ_SENDKEYCONTROL /// wParam = MAKEWPARAM(ctlMask, updown); /// ctlMask is IMEKEYCTRLMASK_XXX combination /// upDown is IMEKEYCTRL_UP or DOWN /// lParam = (LPARAM)wvKey; //Virtual keycode. /// IMEPADREQ_SENDKEYCONTROL = IMEPADREQ_FIRST + 5, /// /// IMEPADREQ_GETSELECTEDSTRING /// Not implemented in version 6.0.0 /// wParam = 0; /// IMEPADREQ_GETSELECTEDSTRING = IMEPADREQ_FIRST + 7, /// /// IMEPADREQ_SETAPPLETDATA /// wParam = (WPARAM)(PBYTE)pByte; //address of applet's data. /// lParam = (LPARAM)(INT)size; //byte size of pByte. /// IMEPADREQ_SETAPPLETDATA = IMEPADREQ_FIRST + 9, /// /// IMEPADREQ_GETAPPLETDATA /// wParam = (WPARAM)(PBYTE)pByte; //address of applet's data. /// lParam = (LPARAM)(INT)size; //byte size of pByte. /// IMEPADREQ_GETAPPLETDATA = IMEPADREQ_FIRST + 10, /// /// IMEPADREQ_SETTITLEFONT /// wParam = (WPARAM)(LPWSTR)lpwstrFontFace; //FontFace name /// lParam = (LPARAM)(INT)charSet; //character set /// IMEPADREQ_SETTITLEFONT = IMEPADREQ_FIRST + 11, /// /// IMEPADREQ_GETCOMPOSITIONSTRINGID /// wParam = (WPARAM)(LPIMECHARINFO)lpCharInfo; /// lParam = (LPARAM)(INT)dwMaxLen; /// IMEPADREQ_GETCOMPOSITIONSTRINGID = IMEPADREQ_FIRST + 13, /// /// IMEPADREQ_INSERTSTRINGCANDIDATEINFO /// wParam = (WPARAM)(LPIMESTRINGCANDIDATEINFO)lpCandInfo; /// lParam = (LPARAM)(WORD)wStartPos; /// IMEPADREQ_INSERTSTRINGCANDIDATEINFO = IMEPADREQ_FIRST + 14, /// /// IMEPADREQ_CHANGESTRINGCANDIDATEINFO /// wParam = (WPARAM)(LPIMESTRINGCANDIDATEINFO)lpCandInfo; /// lParam = MAKELPARAM(startPos, length); /// IMEPADREQ_CHANGESTRINGCANDIDATEINFO = IMEPADREQ_FIRST + 15, /// /// IMEPADREQ_INSERTSTRINGINFO /// wParam = (WPARAM)(LPIMESTRINGINFO)lpStrInfo; /// lParam = dwStartPos /// IMEPADREQ_INSERTSTRINGINFO = IMEPADREQ_FIRST + 18, /// /// IMEPADREQ_CHANGESTRINGINFO /// wParam = (WPARAM)(LPIMESTRINGINFO)lpStrInfo; /// lParam = MAKELPARAM(wStartPos, wLength); /// IMEPADREQ_CHANGESTRINGINFO = IMEPADREQ_FIRST + 19, } /// The IImePadApplet notify code. [PInvokeData("imepad.h", MSDNShortId = "NN:imepad.IImePadApplet")] public enum IMEPN : uint { /// The applet is activated. IMEPN_ACTIVATE = IMEPN_FIRST + 1, /// The applet is inactivate. IMEPN_INACTIVATE = IMEPN_FIRST + 2, /// IMEPad and the applet are shown. IMEPN_SHOW = IMEPN_FIRST + 4, /// IMEPad and the applet are hidden. IMEPN_HIDE = IMEPN_FIRST + 5, /// The applet size is changing. IMEPN_SIZECHANGING = IMEPN_FIRST + 6, /// The applet size has changed. IMEPN_SIZECHANGED = IMEPN_FIRST + 7, /// The applet setting is selected in IMEPad menu. IMEPN_CONFIG = IMEPN_FIRST + 8, /// The applet help is selected in IMEPad menu. IMEPN_HELP = IMEPN_FIRST + 9, /// IMEPN_QUERYCAND = IMEPN_FIRST + 10, /// IMEPN_APPLYCAND = IMEPN_FIRST + 11, /// IMEPN_APPLYCANDEX = IMEPN_FIRST + 12, /// IMEPN_SETTINGCHANGED = IMEPN_FIRST + 13, /// IMEPN_USER = IMEPN_FIRST + 100 } /// [PInvokeData("imepad.h")] [Flags] public enum INFOMASK : uint { /// INFOMASK_NONE = 0x00000000, /// INFOMASK_QUERY_CAND = 0x00000001, /// INFOMASK_APPLY_CAND = 0x00000002, /// INFOMASK_APPLY_CAND_EX = 0x00000004, /// INFOMASK_STRING_FIX = 0x00010000, /// INFOMASK_HIDE_CAND = 0x00020000, /// INFOMASK_BLOCK_CAND = 0x00040000, } /// Mask flags for IMEAPPLETCFG [Flags] public enum IPACFG : uint { /// None IPACFG_NONE = 0, /// The applet has a property Dialog. If this flag is set, IImePad calls IImePadApplet::Notify with IMEPN_CFG. IPACFG_PROPERTY = 1, /// The applet has help. If this flag is set, IImePad calls IImePadApplet::Notify with IMEPN_HELP. IPACFG_HELP = 2, /// wchTitle is set. IPACFG_TITLE = 0x00010000, /// wchTitleFontFace and dwCharSet are set. IPACFG_TITLEFONTFACE = 0x00020000, /// iCategory is set. IPACFG_CATEGORY = 0x00040000, /// LangID is set. IPACFG_LANG = 0x00000010, } /// APPLETCFG iCategory [PInvokeData("imepad.h")] public enum IPACID { /// IPACID_NONE = 0x0000, /// IPACID_SOFTKEY = 0x0001, /// IPACID_HANDWRITING = 0x0002, /// IPACID_STROKESEARCH = 0x0003, /// IPACID_RADICALSEARCH = 0x0004, /// IPACID_SYMBOLSEARCH = 0x0005, /// IPACID_VOICE = 0x0006, /// IPACID_EPWING = 0x0007, /// IPACID_OCR = 0x0008, /// IPACID_CHARLIST = 0x0009, /// IPACID_USER = 0x0100, } /// Applet window style. [PInvokeData("imepad.h", MSDNShortId = "NS:imepad.tagIMEAPPLETUI")] [Flags] public enum IPAWS : uint { /// Show the applet as an enabled window. IPAWS_ENABLED = 0x00000001, /// Send the IMEPN_SIZECHANGING or IMEPN_SIZECHANGED notify code to the applet. IPAWS_SIZINGNOTIFY = 0x00000004, /// Vertically fixed. IPAWS_VERTICALFIXED = 0x00000100, /// Horizontally fixed. IPAWS_HORIZONTALFIXED = 0x00000200, /// Size is fixed. IPAWS_SIZEFIXED = 0x00000300, /// Max width is fixed. IPAWS_MAXWIDTHFIXED = 0x00001000, /// Max height is fixed. IPAWS_MAXHEIGHTFIXED = 0x00002000, /// Max size is fixed. IPAWS_MAXSIZEFIXED = 0x00003000, /// Min width is fixed. IPAWS_MINWIDTHFIXED = 0x00010000, /// Min height is fixed. IPAWS_MINHEIGHTFIXED = 0x00020000, /// Min size is fixed. IPAWS_MINSIZEFIXED = 0x00030000, } /// /// The IImePad interface inserts text into apps from IMEPadApplets that implement the IImePadApplet interface. /// IMEPadApplets can insert their own strings into the current active app by calling IImePad and the Microsoft IME. /// // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nn-imepad-iimepad [PInvokeData("imepad.h", MSDNShortId = "NN:imepad.IImePad")] [ComImport, Guid("5D8E643A-C3A9-11d1-AFEF-00805F0C8B6D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IImePad { /// /// Called by an IImePadApplet to insert text into an app. /// /// Request is the only method that IImePadApplet can call. By calling this method with one of the IMEPADREQ_* request /// IDs, IImePadApplet can insert text into an app and can control IME's composition string in an app. /// /// /// The interface pointer of the calling applet. /// /// The type of request (the request ID). This must be set to one of the following values: /// /// /// Value /// Meaning /// /// /// IMEPADREQ_INSERTSTRING /// Insert a string into the app as a composition string. /// /// /// IMEPADREQ_SENDCONTROL /// Controls composition of the string and caret in the app. /// /// /// IMEPADREQ_SETAPPLETSIZE /// Set a new applet window size. /// /// /// IMEPADREQ_GETCOMPOSITIONSTRING /// Gets the current composition string text. /// /// /// IMEPADREQ_GETCOMPOSITIONSTRINGINFO /// Gets information about the current composition string. /// /// /// IMEPADREQ_DELETESTRING /// Delete the composition string. /// /// /// IMEPADREQ_CHANGESTRING /// Replace part of the composition string. /// /// /// IMEPADREQ_GETAPPLHWND /// Gets the application window handle. /// /// /// IMEPADREQ_FORCEIMEPADWINDOWSHOW /// Keeps the ImePad window visible. /// /// /// IMEPADREQ_POSTMODALNOTIFY /// /// Causes IImePad to call the applet's Notify method asynchronously with a specific notification Id and user-defined data. /// /// /// /// IMEPADREQ_GETDEFAULTUILANGID /// Gets the recommended (default) ImePad applet UI Language. /// /// /// IMEPADREQ_GETCURRENTUILANG /// Get the current ImePad applet UI Language. /// /// /// IMEPADREQ_GETAPPLETUISTYLE /// Gets the applet's UI style ( IPAWS_* flags). /// /// /// IMEPADREQ_SETAPPLETUISTYLE /// Sets the applet's UI style ( IPAWS_* flags). /// /// /// IMEPADREQ_ISAPPLETACTIVE /// Determines if the applet is active. /// /// /// IMEPADREQ_ISIMEPADWINDOWVISIBLE /// Determines if ImePad is visible. /// /// /// IMEPADREQ_SETAPPLETMINMAXSIZE /// Set the minimum and maximum applet size. /// /// /// IMEPADREQ_GETCONVERSIONSTATUS /// /// Gets the current application IME's conversion status. For a complete list of conversion and sentence modes, see the header file Imm.h. /// /// /// /// IMEPADREQ_GETVERSION /// Gets IImePad's version information. /// /// /// IMEPADREQ_GETCURRENTIMEINFO /// Gets the IME information that invoked ImePad. /// /// /// /// Additional information specific to reqId. /// Additional information specific to reqId. /// S_OK if successful, otherwise E_FAIL. /// /// Possible IMEPADCTRL_* values /// These are the possible values that wParam can take when reqId is set to IMEPADREQ_SENDCONTROL: /// /// /// Name /// Value /// Description /// /// /// IMEPADCTRL_CONVERTALL /// 1 /// Convert all composition strings. /// /// /// IMEPADCTRL_DETERMINALL /// 2 /// Determine all composition strings. /// /// /// IMEPADCTRL_DETERMINCHAR /// 3 /// Determine specified count's composition string character. /// /// /// IMEPADCTRL_CLEARALL /// 4 /// Clear all composition strings. /// /// /// IMEPADCTRL_CARETLEFT /// 6 /// Move character caret to the left. /// /// /// IMEPADCTRL_CARETRIGHT /// 7 /// Move character caret to the right. /// /// /// IMEPADCTRL_CARETTOP /// 8 /// Move character caret to the top of the composition string. /// /// /// IMEPADCTRL_CARETBOTTOM /// 9 /// Move character caret to the end of the composition string. /// /// /// IMEPADCTRL_CARETBACKSPACE /// 10 /// Delete composition string's character before the caret (like the BACKSPACE key). /// /// /// IMEPADCTRL_CARETDELETE /// 11 /// Delete composition string's character after the caret (like the DELETE key). /// /// /// IMEPADCTRL_PHRASEDELETE /// 12 /// Delete the composition string's phrase. /// /// /// IMEPADCTRL_INSERTSPACE /// 13 /// Insert a space character—full width or half width depending on the IME configuration. /// /// /// IMEPADCTRL_INSERTFULLSPACE /// 14 /// Insert full width space. /// /// /// IMEPADCTRL_INSERTHALFSPACE /// 15 /// Insert half width space. /// /// /// IMEPADCTRL_ONIME /// 16 /// Set IME ON. /// /// /// IMEPADCTRL_OFFIME /// 17 /// Set IME OFF. /// /// /// IMEPADCTRL_ONPRECONVERSION /// 18 /// Set pre-conversion ON. /// /// /// IMEPADCTRL_OFFPRECONVERSION /// 19 /// Set pre-conversion OFF. /// /// /// IMEPADCTRL_PHONETICCANDIDATE /// 20 /// Open IME's candidate. /// /// ///  /// Possible IPAWS_* values /// /// These are the possible values that can be received via wParam when reqId is set to /// IMEPADREQ_GETAPPLETUISTYLE, or that wParam can be set to when reqId is set to IMEPADREQ_SETAPPLETUISTYLE: /// /// /// /// Name /// Description /// /// /// IPAWS_ENABLED /// Show the applet as an enabled window. /// /// /// IPAWS_SIZINGNOTIFY /// Send the IMEPN_SIZECHANGING or IMEPN_SIZECHANGED notify code to the applet. /// /// /// IPAWS_VERTICALFIXED /// Vertically fixed. /// /// /// IPAWS_HORIZONTALFIXED /// Horizontally fixed. /// /// /// IPAWS_SIZEFIXED /// Size is fixed. /// /// /// IPAWS_MAXWIDTHFIXED /// Max width is fixed. /// /// /// IPAWS_MAXHEIGHTFIXED /// Max height is fixed. /// /// /// IPAWS_MAXSIZEFIXED /// Max size is fixed. /// /// /// IPAWS_MINWIDTHFIXED /// Min width is fixed. /// /// /// IPAWS_MINHEIGHTFIXED /// Min height is fixed. /// /// /// IPAWS_MINSIZEFIXED /// Min size is fixed. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nf-imepad-iimepad-request HRESULT Request( [in] IImePadApplet // *pIImePadApplet, [in] INT reqId, [in, out] WPARAM wParam, [in, out] LPARAM lParam ); void Request(IImePadApplet pIImePadApplet, IMEPADREQ reqId, IntPtr wParam, IntPtr lParam); } /// /// The IImePadApplet interface inputs strings into apps through the IImePad interface. /// /// IImePadApplet should be implemented as a DLL inproc server. The developer can implement multiple IImePadApplet /// interfaces in one DLL. To specify and emulate the IImePadApplet interface in the applet DLL, the applet must also provide the /// IImeSpecifyApplets interface. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nn-imepad-iimepadapplet [PInvokeData("imepad.h", MSDNShortId = "NN:imepad.IImePadApplet")] [ComImport, Guid("5D8E643B-C3A9-11d1-AFEF-00805F0C8B6D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IImePadApplet { /// Called from IImePad interface to initialize IImePadApplet. /// Pointer to IImePad ( IUnknown *) /// S_OK if successful, otherwise E_FAIL. /// /// When the ImePad user interface is created, IImePad calls this method and sets the IImePad interface pointer as an argument. The /// applet can save and use this pointer to call the pIImePad->IImePad::Request method. /// // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nf-imepad-iimepadapplet-initialize HRESULT Initialize( IUnknown // *lpIImePad ); [PreserveSig] HRESULT Initialize(IImePad lpIImePad); /// Called from IImePad to terminate IImePadApplet when the IMEPad instance exits. /// S_OK if successful, otherwise E_FAIL. // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nf-imepad-iimepadapplet-terminate HRESULT Terminate(); [PreserveSig] HRESULT Terminate(); /// Gets the applet configuration. /// The lp applet CFG. [PreserveSig] HRESULT GetAppletConfig(out IMEAPPLETCFG lpAppletCfg); /// /// Called from IImePad to get the applet's window handle, style, and size. /// The applet can set its window style and sizing policy. /// /// Window handle of the IImePad GUI. The applet can create the window as its child window. /// Pointer to IMEAPPLETUI structure. The applet can set its window style. /// S_OK if successful, otherwise E_FAIL. // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nf-imepad-iimepadapplet-createui HRESULT CreateUI( [in] HWND // hwndParent, [in] LPIMEAPPLETUI lpImeAppletUI ); [PreserveSig] HRESULT CreateUI(HWND hwndParent, in IMEAPPLETUI lpImeAppletUI); /// Called from IImePad to pass information with a notify code /// Pointer of IUnknown interface. To get the IImePad interface pointer, use QueryInterface. /// The IImePadApplet notify code. See Remarks for the possible codes. /// Additional information specific to notify. /// Additional information specific to notify. /// S_OK if successful, otherwise E_FAIL. /// /// Possible notify codes ( IMEPN_* values) /// /// /// Code /// Description /// /// /// IMEPN_ACTIVATE /// The applet is activated. /// /// /// IMEPN_INACTIVATE /// The applet is inactivate. /// /// /// IMEPN_SHOW /// IMEPad and the applet are shown. /// /// /// IMEPN_HIDE /// IMEPad and the applet are hidden. /// /// /// IMEPN_SIZECHANGING /// The applet size is changing. /// /// /// IMEPN_SIZECHANGED /// The applet size has changed. /// /// /// IMEPN_CONFIG /// The applet setting is selected in IMEPad menu. /// /// /// IMEPN_HELP /// The applet help is selected in IMEPad menu. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nf-imepad-iimepadapplet-notify HRESULT Notify( [in] IUnknown *lpImePad, // [in] INT notify, [in, out] WPARAM wParam, [in, out] LPARAM lParam ); [PreserveSig] HRESULT Notify(IImePad lpImePad, IMEPN notify, IntPtr wParam, IntPtr lParam); } /// /// The IImeSpecifyApplets interface specifies methods called from the IImePad interface object to emulate the IImePadApplet interface. /// // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nn-imepad-iimespecifyapplets [PInvokeData("imepad.h", MSDNShortId = "NN:imepad.IImeSpecifyApplets")] [ComImport, Guid("5D8E643C-C3A9-11d1-AFEF-00805F0C8B6D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IImeSpecifyApplets { /// Called from the IImePad interface to enumerate the IImePadApplet interfaces that are implemented. /// /// IID of the IImePadApplet interface. This IID is defined in Imepad.h as IID_IImePadApplet. This is for /// IImePadApplet's future enhancement /// /// Pointer to a APPLETIIDLIST structure. Sets the applet's IID list and count. /// S_OK if successful, otherwise E_FAIL. // https://learn.microsoft.com/en-us/windows/win32/api/imepad/nf-imepad-iimespecifyapplets-getappletiidlist HRESULT GetAppletIIDList( // [in] REFIID refiid, [in, out] LPAPPLETIDLIST lpIIDList ); [PreserveSig] HRESULT GetAppletIIDList(in Guid refiid, ref APPLETIDLIST lpIIDList); } /// Undocumented. public static uint APPLETIDFROMCHARINFO(CHARINFO charInfo) => (uint)(charInfo & CHARINFO.CHARINFO_APPLETID_MASK) >> 24; /// Undocumented. public static uint CHARIDFROMCHARINFO(CHARINFO charInfo) => (uint)(charInfo & CHARINFO.CHARINFO_CHARID_MASK); /// Undocumented. public static FEID FEIDFROMCHARINFO(CHARINFO charInfo) => (FEID)((uint)(charInfo & CHARINFO.CHARINFO_FEID_MASK) >> 20); /// Specifies an IImePadApplet IID list. // https://learn.microsoft.com/en-us/windows/win32/api/imepad/ns-imepad-appletidlist typedef struct tagAPPLETIDLIST { INT count; IID // *pIIDList; } APPLETIDLIST, *LPAPPLETIDLIST; [PInvokeData("imepad.h", MSDNShortId = "NS:imepad.tagAPPLETIDLIST")] [StructLayout(LayoutKind.Sequential)] public struct APPLETIDLIST : IArrayStruct { /// The number of the IID's implemented in this applet. public int count; private IntPtr _pIIDList; /// The IID list. This must be allocated with CoTaskMemAlloc. public readonly Guid[] pIIDList => _pIIDList.ToArray(count) ?? new Guid[0]; /// Creates an structure with space allocated for pIIDList. /// The number of the IID's implemented in this applet. /// An structure with space allocated for pIIDList. public static APPLETIDLIST CreateAllocated(int cnt) { APPLETIDLIST al = new(); al._pIIDList = Marshal.AllocCoTaskMem((al.count = cnt) * Marshal.SizeOf(typeof(Guid))); return al; } } /// Used to specify and set applet configuration in IImePad. // https://learn.microsoft.com/en-us/windows/win32/api/imepad/ns-imepad-imeappletcfg typedef struct tagAPPLETCFG { DWORD dwConfig; WCHAR // wchTitle[MAX_APPLETTITLE]; WCHAR wchTitleFontFace[MAX_FONTFACE]; DWORD dwCharSet; INT iCategory; HICON hIcon; LANGID langID; WORD // dummy; LPARAM lReserved1; } IMEAPPLETCFG, *LPIMEAPPLETCFG; [PInvokeData("imepad.h", MSDNShortId = "NS:imepad.tagAPPLETCFG")] [StructLayout(LayoutKind.Sequential)] public struct IMEAPPLETCFG { /// /// Combination of IPACFG_* flags. /// /// /// Value /// Meaning /// /// /// IPACFG_NONE /// /// /// /// IPACFG_PROPERTY /// The applet has a property Dialog. If this flag is set, IImePad calls IImePadApplet::Notify with IMEPN_CFG. /// /// /// IPACFG_HELP /// The applet has help. If this flag is set, IImePad calls IImePadApplet::Notify with IMEPN_HELP. /// /// /// IPACFG_TITLE /// wchTitle is set. /// /// /// IPACFG_TITLEFONTFACE /// wchTitleFontFace and dwCharSet are set. /// /// /// IPACFG_CATEGORY /// iCategory is set. /// /// /// IPACFG_LANG /// LangID is set. /// /// /// public IPACFG dwConfig; /// The applet's title, in Unicode. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64 /*MAX_APPLETTITLE*/)] public string wchTitle; /// The applet title's FontFace name. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32 /*MAX_FONTFACE*/)] public string wchTitleFontFace; /// The applet font's character set. public uint dwCharSet; /// Not used. public int iCategory; /// The icon handle for the ImePad applet's menu. public HICON hIcon; /// The applet's language ID. public LANGID langID; /// Not used. public ushort dummy; /// Reserved. public IntPtr lReserved1; } /// Used by IImePadApplet::CreateUI to specify applet window style. // https://learn.microsoft.com/en-us/windows/win32/api/imepad/ns-imepad-imeappletui typedef struct tagIMEAPPLETUI { HWND hwnd; DWORD // dwStyle; INT width; INT height; INT minWidth; INT minHeight; INT maxWidth; INT maxHeight; LPARAM lReserved1; LPARAM lReserved2; } // IMEAPPLETUI, *LPIMEAPPLETUI; [PInvokeData("imepad.h", MSDNShortId = "NS:imepad.tagIMEAPPLETUI")] [StructLayout(LayoutKind.Sequential)] public struct IMEAPPLETUI { /// Window handle created by applet window. public HWND hwnd; /// /// Applet window style. The style is a combination of IPAWS_ flags; see the Remarks of IImePad::Request for the possible /// IPAWS_ flags. /// public IPAWS dwStyle; /// The applet window's initial width. public int width; /// The applet window's initial height. public int height; /// Minimum width of the applet window. Valid only when IPAWS_MINWIDTHFIXED style is set in dwStyle. public int minWidth; /// Minimum height of applet window. Valid only when IPAWS_MINHEIGHTFIXED is set in dwStyle. public int minHeight; /// Maximum width of applet window. Valid only when IPAWS_MAXWIDTHFIXED is set in dwStyle. public int maxWidth; /// Maximum height of applet window. Valid only when IPAWS_MAXHEIGHTFIXED is set in dwStyle. public int maxHeight; /// Reserved. public IntPtr lReserved1; /// Reserved. public IntPtr lReserved2; } /// Composition string's each character. wParam for IMEPADREQ_GETCOMPOSITIONSTRINGID. [PInvokeData("imepad.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct IMECHARINFO { /// public char wch; /// public CHARINFO dwCharInfo; } /// Composition string's information. wParam for IMEPADREQ_GETCOMPOSITIONSTRINGINFO. [PInvokeData("imepad.h")] [StructLayout(LayoutKind.Sequential)] public struct IMECOMPOSITIONSTRINGINFO { /// public int iCompStrLen; /// public int iCaretPos; /// public int iEditStart; /// public int iEditLen; /// public int iTargetStart; /// public int iTargetLen; } /// FarEast specified data. [PInvokeData("imepad.h")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwSize))] [StructLayout(LayoutKind.Sequential)] public struct IMEFAREASTINFO { /// total structure size. public uint dwSize; /// Data type. public IMEFAREASTINFO_TYPE dwType; /// fareast spec data. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] dwData; } /// IMEPADREQ_INSERTITEMCANDIDATE structure [PInvokeData("imepad.h")] [StructLayout(LayoutKind.Sequential)] public struct IMEITEM { /// public int cbSize; /// public int iType; /// public IntPtr lpItemData; } /// [PInvokeData("imepad.h")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler))] [StructLayout(LayoutKind.Sequential)] public struct IMEITEMCANDIDATE { /// public uint uCount; /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public IMEITEM[] imeItem; } /// wParam value for IMEPADREQ_INSERTSTRINGCANDIDATE [PInvokeData("imepad.h")] [VanaraMarshaler(typeof(AnySizeStringMarshaler))] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct IMESTRINGCANDIDATE { /// public uint uCount; /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string lpwstr; } /// String candidate info [PInvokeData("imepad.h")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(uCount))] [StructLayout(LayoutKind.Sequential)] public struct IMESTRINGCANDIDATEINFO { /// public FEID dwFarEastId; /// Pointer to a structure. public IntPtr /* IMEFAREASTINFO* */ lpFarEastInfo; /// public INFOMASK fInfoMask; /// public int iSelIndex; /// public uint uCount; /// [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.LPWStr, SizeConst = 1)] public string[] lpwstr; } /// String with FarEast id. wParam for IMEPADREQ_INSERTSTRINGINFO. [PInvokeData("imepad.h")] [StructLayout(LayoutKind.Sequential)] public struct IMESTRINGINFO { /// public FEID dwFarEastId; /// [MarshalAs(UnmanagedType.LPWStr)] public string lpwstr; } }