📄 activeimm_tlb.pas
字号:
function CreateContext(out phIMC: LongWord): HResult;
function DestroyContext(hIME: LongWord): HResult;
function EnumRegisterWordA(var hKL: Pointer; szReading: PAnsiChar; dwStyle: LongWord;
szRegister: PAnsiChar; var pData: Pointer; out pEnum: IEnumRegisterWordA): HResult;
function EnumRegisterWordW(var hKL: Pointer; szReading: PWideChar; dwStyle: LongWord;
szRegister: PWideChar; var pData: Pointer;
out pEnum: IEnumRegisterWordW): HResult;
function EscapeA(var hKL: Pointer; hIMC: LongWord; uEscape: SYSUINT; var pData: Pointer;
out plResult: LONG_PTR): HResult;
function EscapeW(var hKL: Pointer; hIMC: LongWord; uEscape: SYSUINT; var pData: Pointer;
out plResult: LONG_PTR): HResult;
function GetCandidateListA(hIMC: LongWord; dwIndex: LongWord; uBufLen: SYSUINT;
out pCandList: CANDIDATELIST; out puCopied: SYSUINT): HResult;
function GetCandidateListW(hIMC: LongWord; dwIndex: LongWord; uBufLen: SYSUINT;
out pCandList: CANDIDATELIST; out puCopied: SYSUINT): HResult;
function GetCandidateListCountA(hIMC: LongWord; out pdwListSize: LongWord;
out pdwBufLen: LongWord): HResult;
function GetCandidateListCountW(hIMC: LongWord; out pdwListSize: LongWord;
out pdwBufLen: LongWord): HResult;
function GetCandidateWindow(hIMC: LongWord; dwIndex: LongWord; out pCandidate: CANDIDATEFORM): HResult;
function GetCompositionFontA(hIMC: LongWord; out plf: LOGFONTA): HResult;
function GetCompositionFontW(hIMC: LongWord; out plf: LOGFONTW): HResult;
function GetCompositionStringA(hIMC: LongWord; dwIndex: LongWord; dwBufLen: LongWord;
out plCopied: Integer; out pBuf: Pointer): HResult;
function GetCompositionStringW(hIMC: LongWord; dwIndex: LongWord; dwBufLen: LongWord;
out plCopied: Integer; out pBuf: Pointer): HResult;
function GetCompositionWindow(hIMC: LongWord; out pCompForm: COMPOSITIONFORM): HResult;
function GetContext(var hWnd: _RemotableHandle; out phIMC: LongWord): HResult;
function GetConversionListA(var hKL: Pointer; hIMC: LongWord; pSrc: PAnsiChar; uBufLen: SYSUINT;
uFlag: SYSUINT; out pDst: CANDIDATELIST; out puCopied: SYSUINT): HResult;
function GetConversionListW(var hKL: Pointer; hIMC: LongWord; pSrc: PWideChar;
uBufLen: SYSUINT; uFlag: SYSUINT; out pDst: CANDIDATELIST;
out puCopied: SYSUINT): HResult;
function GetConversionStatus(hIMC: LongWord; out pfdwConversion: LongWord;
out pfdwSentence: LongWord): HResult;
function GetDefaultIMEWnd(var hWnd: _RemotableHandle; out phDefWnd: wireHWND): HResult;
function GetDescriptionA(var hKL: Pointer; uBufLen: SYSUINT; szDescription: PAnsiChar;
out puCopied: SYSUINT): HResult;
function GetDescriptionW(var hKL: Pointer; uBufLen: SYSUINT; szDescription: PWideChar;
out puCopied: SYSUINT): HResult;
function GetGuideLineA(hIMC: LongWord; dwIndex: LongWord; dwBufLen: LongWord; pBuf: PAnsiChar;
out pdwResult: LongWord): HResult;
function GetGuideLineW(hIMC: LongWord; dwIndex: LongWord; dwBufLen: LongWord; pBuf: PWideChar;
out pdwResult: LongWord): HResult;
function GetIMEFileNameA(var hKL: Pointer; uBufLen: SYSUINT; szFileName: PAnsiChar;
out puCopied: SYSUINT): HResult;
function GetIMEFileNameW(var hKL: Pointer; uBufLen: SYSUINT; szFileName: PWideChar;
out puCopied: SYSUINT): HResult;
function GetOpenStatus(hIMC: LongWord): HResult;
function GetProperty(var hKL: Pointer; fdwIndex: LongWord; out pdwProperty: LongWord): HResult;
function GetRegisterWordStyleA(var hKL: Pointer; nItem: SYSUINT; out pStyleBuf: STYLEBUFA;
out puCopied: SYSUINT): HResult;
function GetRegisterWordStyleW(var hKL: Pointer; nItem: SYSUINT; out pStyleBuf: STYLEBUFW;
out puCopied: SYSUINT): HResult;
function GetStatusWindowPos(hIMC: LongWord; out pptPos: tagPOINT): HResult;
function GetVirtualKey(var hWnd: _RemotableHandle; out puVirtualKey: SYSUINT): HResult;
function InstallIMEA(szIMEFileName: PAnsiChar; szLayoutText: PAnsiChar; out phKL: Pointer): HResult;
function InstallIMEW(szIMEFileName: PWideChar; szLayoutText: PWideChar; out phKL: Pointer): HResult;
function IsIME(var hKL: Pointer): HResult;
function IsUIMessageA(var hWndIME: _RemotableHandle; msg: SYSUINT; wParam: UINT_PTR;
lParam: LONG_PTR): HResult;
function IsUIMessageW(var hWndIME: _RemotableHandle; msg: SYSUINT; wParam: UINT_PTR;
lParam: LONG_PTR): HResult;
function NotifyIME(hIMC: LongWord; dwAction: LongWord; dwIndex: LongWord; dwValue: LongWord): HResult;
function REGISTERWORDA(var hKL: Pointer; szReading: PAnsiChar; dwStyle: LongWord; szRegister: PAnsiChar): HResult;
function REGISTERWORDW(var hKL: Pointer; szReading: PWideChar; dwStyle: LongWord;
szRegister: PWideChar): HResult;
function ReleaseContext(var hWnd: _RemotableHandle; hIMC: LongWord): HResult;
function SetCandidateWindow(hIMC: LongWord; var pCandidate: CANDIDATEFORM): HResult;
function SetCompositionFontA(hIMC: LongWord; var plf: LOGFONTA): HResult;
function SetCompositionFontW(hIMC: LongWord; var plf: LOGFONTW): HResult;
function SetCompositionStringA(hIMC: LongWord; dwIndex: LongWord; var pComp: Pointer;
dwCompLen: LongWord; var pRead: Pointer; dwReadLen: LongWord): HResult;
function SetCompositionStringW(hIMC: LongWord; dwIndex: LongWord; var pComp: Pointer;
dwCompLen: LongWord; var pRead: Pointer; dwReadLen: LongWord): HResult;
function SetCompositionWindow(hIMC: LongWord; var pCompForm: COMPOSITIONFORM): HResult;
function SetConversionStatus(hIMC: LongWord; fdwConversion: LongWord; fdwSentence: LongWord): HResult;
function SetOpenStatus(hIMC: LongWord; fOpen: Integer): HResult;
function SetStatusWindowPos(hIMC: LongWord; var pptPos: tagPOINT): HResult;
function SimulateHotKey(var hWnd: _RemotableHandle; dwHotKeyID: LongWord): HResult;
function UnregisterWordA(var hKL: Pointer; szReading: PAnsiChar; dwStyle: LongWord;
szUnregister: PAnsiChar): HResult;
function UnregisterWordW(var hKL: Pointer; szReading: PWideChar; dwStyle: LongWord;
szUnregister: PWideChar): HResult;
function Activate(fRestoreLayout: Integer): HResult;
function Deactivate: HResult;
function OnDefWindowProc(var hWnd: _RemotableHandle; msg: SYSUINT; wParam: UINT_PTR;
lParam: LONG_PTR; out plResult: LONG_PTR): HResult;
function FilterClientWindows(var aaClassList: Word; uSize: SYSUINT): HResult;
function GetCodePageA(var hKL: Pointer; out uCodePage: SYSUINT): HResult;
function GetLangId(var hKL: Pointer; out plid: Word): HResult;
function AssociateContextEx(var hWnd: _RemotableHandle; hIMC: LongWord; dwFlags: LongWord): HResult;
function DisableIME(idThread: LongWord): HResult;
function GetImeMenuItemsA(hIMC: LongWord; dwFlags: LongWord; dwType: LongWord;
var pImeParentMenu: IMEMENUITEMINFOA;
out pImeMenu: IMEMENUITEMINFOA; dwSize: LongWord;
out pdwResult: LongWord): HResult;
function GetImeMenuItemsW(hIMC: LongWord; dwFlags: LongWord; dwType: LongWord;
var pImeParentMenu: IMEMENUITEMINFOW;
out pImeMenu: IMEMENUITEMINFOW; dwSize: LongWord;
out pdwResult: LongWord): HResult;
function EnumInputContext(idThread: LongWord; out ppEnum: IEnumInputContext): HResult;
property DefaultInterface: IActiveIMMApp read GetDefaultInterface;
published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
property Server: TCActiveIMMProperties read GetServerProperties;
{$ENDIF}
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object : TCActiveIMM
// (This object is used by the IDE's Property Inspector to allow editing
// of the properties of this server)
// *********************************************************************//
TCActiveIMMProperties = class(TPersistent)
private
FServer: TCActiveIMM;
function GetDefaultInterface: IActiveIMMApp;
constructor Create(AServer: TCActiveIMM);
protected
public
property DefaultInterface: IActiveIMMApp read GetDefaultInterface;
published
end;
{$ENDIF}
implementation
uses
ComObj;
class function CoCActiveIMM.Create: IActiveIMMApp;
begin
Result := CreateComObject(CLASS_CActiveIMM) as IActiveIMMApp;
end;
class function CoCActiveIMM.CreateRemote(const MachineName: AnsiString): IActiveIMMApp;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CActiveIMM) as IActiveIMMApp;
end;
procedure TCActiveIMM.InitServerData;
const
CServerData: TServerData = (
ClassID: '{4955DD33-B159-11D0-8FCF-00AA006BCC59}';
IntfIID: '{08C0E040-62D1-11D1-9326-0060B067B86E}';
EventIID: '';
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TCActiveIMM.Connect;
var
punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
Fintf:= punk as IActiveIMMApp;
end;
end;
procedure TCActiveIMM.ConnectTo(svrIntf: IActiveIMMApp);
begin
Disconnect;
FIntf := svrIntf;
end;
procedure TCActiveIMM.DisConnect;
begin
if Fintf <> nil then
begin
FIntf := nil;
end;
end;
function TCActiveIMM.GetDefaultInterface: IActiveIMMApp;
begin
if FIntf = nil then
Connect;
Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
Result := FIntf;
end;
constructor TCActiveIMM.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps := TCActiveIMMProperties.Create(Self);
{$ENDIF}
end;
destructor TCActiveIMM.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps.Free;
{$ENDIF}
inherited Destroy;
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TCActiveIMM.GetServerProperties: TCActiveIMMProperties;
begin
Result := FProps;
end;
{$ENDIF}
function TCActiveIMM.AssociateContext(var hWnd: _RemotableHandle; hIME: LongWord;
out phPrev: LongWord): HResult;
begin
Result := DefaultInterface.AssociateContext(hWnd, hIME, phPrev);
end;
function TCActiveIMM.ConfigureIMEA(var hKL: Pointer; var hWnd: _RemotableHandle; dwMode: LongWord;
var pData: REGISTERWORDA): HResult;
begin
Result := DefaultInterface.ConfigureIMEA(hKL, hWnd, dwMode, pData);
end;
function TCActiveIMM.ConfigureIMEW(var hKL: Pointer; var hWnd: _RemotableHandle; dwMode: LongWord;
var pData: REGISTERWORDW): HResult;
begin
Result := DefaultInterface.ConfigureIMEW(hKL, hWnd, dwMode, pData);
end;
function TCActiveIMM.CreateContext(out phIMC: LongWord): HResult;
begin
Result := DefaultInterface.CreateContext(phIMC);
end;
function TCActiveIMM.DestroyContext(hIME: LongWord): HResult;
begin
Result := DefaultInterface.DestroyContext(hIME);
end;
function TCActiveIMM.EnumRegisterWordA(var hKL: Pointer; szReading: PAnsiChar; dwStyle: LongWord;
szRegister: PAnsiChar; var pData: Pointer;
out pEnum: IEnumRegisterWordA): HResult;
begin
Result := DefaultInterface.EnumRegisterWordA(hKL, szReading, dwStyle, szRegister, pData, pEnum);
end;
function TCActiveIMM.EnumRegisterWordW(var hKL: Pointer; szReading: PWideChar; dwStyle: LongWord;
szRegister: PWideChar; var pData: Pointer;
out pEnum: IEnumRegisterWordW): HResult;
begin
Result := DefaultInterface.EnumRegisterWordW(hKL, szReading, dwStyle, szRegister, pData, pEnum);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -