動作するようになりました。ImmGetContext、ImmSetComposition、ImmGetComposition、および NormalizeString を使用します。
procedure TForm1.IMEFUNCTION(var msg: TMsg);
var
buf: array [0..20] of char;
hHimc: HIMC;
i, j: integer;
str: string;
temporary: PWideChar;
begin
hHimc:= ImmGetContext (msg.hwnd);
if hHimc = 0 then
Exit;
fillchar (buf, 20, 0);
ImmSetCompositionStringW (hHimc, SCS_SETSTR, PChar (''), Length(''), nil, 0);
ImmGetCompositionString (hHimc, GCS_COMPSTR, @buf, 20);
temporary:= PWideChar(Edit1.Text+buf[0]);
NormalizeString(5 , temporary, -1, buf, 20);
Edit1.Text:=buf;
end;//end if
end;//end for
ImmReleaseContext (handle, hHimc);
end;
補足: 私は実際には TEdit を使用しませんでした。StringGrid と for ループを使用しました。(しかし、一般的なアイデアはそこにあります)