IEnumTfLanguageProfiles = interface
['{3D61BF11-AC5F-42C8-A4CB-931BCC28C744}']
function Next(ulCount: Cardinal; const pProfile: PF_LANGUAGEPROFILE; out pcFetch: Cardinal): HRESULT; stdcall;
MSDN
HRESULT Next( ULONG ulCount<!---->,
TF_LANGUAGEPROFILE* pProfile<!---->,
ULONG* pcFetch<!----> );
Parameters
ulCount
[in] Specifies the number of elements to obtain.
pProfile
[out] Pointer to an array of TF_LANGUAGEPROFILE structures that receives the requested data. This array must be at least ulCount elements in size.
pcFetch
[out] 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.
Next(int count, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)]
TF_LANGUAGEPROFILE[] profiles, out int fetched);
type
PF_LANGUAGEPROFILE = ^TF_LANGUAGEPROFILE;
TF_LANGUAGEPROFILE = packed record
clsid: TGUID;
langid: smallint;
catid: TGUID;
fActive: WordBool;
guidProfile: TGUID;
end;
IEnumGUID = interface
['{0002E000-0000-0000-C000-000000000046}']
function Next(celt: Cardinal; out rgelt: TGUID; out pcFetched: Cardinal): HRESULT; stdcall;
function Skip(celt: Cardinal): HRESULT; stdcall;
function Reset: HRESULT; stdcall;
function Clone(out ppEnum: IEnumGUID): HRESULT; stdcall;
end;
IEnumTfLanguageProfiles = interface
['{3D61BF11-AC5F-42C8-A4CB-931BCC28C744}']
function Clone(out ppEnum: IEnumTfLanguageProfiles): HRESULT; stdcall;
function Next(ulCount: Cardinal; const pProfile: PF_LANGUAGEPROFILE; out pcFetch: Cardinal): HRESULT; stdcall;
function Reset: HRESULT; stdcall;
function Skip(ulCount: Cardinal): HRESULT; stdcall;
end;
ITfInputProcessorProfiles = interface
['{1F02B6C5-7842-4EE6-8A0B-9A24183A95CA}']
function Register(const clsid: TGUID): HRESULT; stdcall;
function Unregister(const clsid: TGUID): HRESULT; stdcall;
function AddLanguageProfile(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; const pchDesc: WideString; cchDesc: Cardinal; const pchIconFile: WideString; cchFile, uIconIndex: Cardinal): HRESULT; stdcall;
function RemoveLanguageProfile(const clsid: TGUID; langid: smallint; out guidProfile: TGUID): HRESULT; stdcall;
function EnumInputProcessorInfo(out ppEnum: IEnumGUID): HRESULT; stdcall;
function GetDefaultLanguageProfile(langid: smallint; const catid: TGUID; out clsid: TGUID; out guidProfile: TGUID): HRESULT; stdcall;
function SetDefaultLanguageProfile(langid: smallint; const clsid: TGUID; const guidProfile: TGUID): HRESULT; stdcall;
function ActivateLanguageProfile(const clsid: TGUID; langid: smallint; const guidProfiles: TGUID): HRESULT; stdcall;
function GetActiveLanguageProfile(const clsid: TGUID; out langid: smallint; out guidProfile: TGUID): HRESULT; stdcall;
function GetLanguageProfileDescription(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; out pbstrProfile: WideString): HRESULT; stdcall;
function GetCurrentLanguage(out langid: smallint): HRESULT; stdcall;
function ChangeCurrentLanguage(langid: smallint): HRESULT; stdcall;
function GetLanguageList(out ppLangId: pointer; out ulCount: Cardinal): HRESULT; stdcall;
function EnumLanguageProfiles(langid: smallint; out ppEnum: IEnumTfLanguageProfiles): HRESULT; stdcall;
function EnableLanguageProfile(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; fEnable: WordBool): HRESULT; stdcall;
function IsEnabledLanguageProfile(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; out fEnabled: WordBool): HRESULT; stdcall;
function EnableLanguageProfileByDefault(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; fEnabled: WordBool): HRESULT; stdcall;
function SubstituteKeyboardLayout(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; hKL: pointer): HRESULT; stdcall;
end;
function TF_CreateInputProcessorProfiles(out profiles: ITfInputProcessorProfiles): HRESULT; stdcall; external 'msctf.dll';
https://github.com/ryancheung/ImeSharp
IterateSubKeys(Registry.CurrentUser, "SOFTWARE\\Microsoft\\CTF\\TIP\\" + subKeyName + "\\LanguageProfile",
https://www.xujun.org/note-48842.html
文/黄忠成
[ ComImport , SecurityCritical , SuppressUnmanagedCodeSecurity ,
Guid ( “1F02B6C5-7842-4EE6-8A0B-9A24183A95CA” ),
InterfaceType ( ComInterfaceType .InterfaceIsIUnknown)]
ITfInputProcessorProfiles
https://github.com/xyzzy-022/xyzzy/issues/170
Vista で読みから変換候補リストを取得する Text Services Framework
http://hp.vector.co.jp/authors/VA050396/tech_01.html
https://github.com/microsoft/Windows-classic-samples/tree/main/Samples/Win7Samples/winui/tsf
https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/winui/tsf/tsfapp/tsfapp.cpp
https://docs.microsoft.com/en-us/windows/win32/api/_tsf/
msctf_TLB.pas
https://github.com/lantaoxu/Windows-Server-2003/blob/5c6fe3db626b63a384230a1aa6b92ac416b0765f/windows/advcore/ctf/inc/msime.h
https://pastebin.com/PBcJeuKV
TSF "Text Services Framework"」の項でチョット触れましたが、これを実現するために ImmGetConversionList 関数を使う人がいます。この関数を使っても不可能ではありませんが、そもそも使うべき関数を間違っています。ImmGetCompositionString 関数ならズバリな解答を得ることができます。しかも、Windows Vista でも問題なく使えます。
http://www.kanazawa-net.ne.jp/~pmansato/net/net_tech_ime.htm
http://hp.vector.co.jp/authors/VA050396/tech_01.html
ImmGetConversionListの代替は?
https://www.petitmonte.com/bbs/answers?question_id=6145
https://docs.microsoft.com/zh-tw/windows/win32/api/msime/
//L"MSIME.China";
//L"MSIME.Japan";
//L"MSIME.Taiwan";
//L"MSIME.Taiwan.ImeBbo";
mepad.h
imm.h
immdev.h
msime.h
msimeapi.h
Text Services Framework, you need these headers:
ctffunc.h
ctfspui.h
ctfutb.h
inputscope.h
msaatext.h
msctf.h