form1.KeyPreview:=true;
//
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_f1 then
Edit1.Text:=Edit1.Text+'¢';
end;
procedure Sendkeys(focushld: HWND; sSend: string);
var
i:integer;
ch: byte;
begin
i := 1;
SendMessage(focushld, WM_IME_SELECT, WPARAM(true), 255);
while i <= Length(sSend) do
begin
ch := byte(sSend[i]);
if Windows.IsDBCSLeadByte(ch) then
begin
Inc(i);
SendMessage(focushld, WM_IME_CHAR, MakeWord(byte(sSend[i]), ch), 0);
end
else
SendMessage(focushld, WM_IME_CHAR, word(ch), 0);
Inc(i);
end;
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key = 'a' then
begin
key := #0;
Sendkeys(ActiveControl.Handle, '¢');
end;
end;