Examples Delphi

Title: replace umlauts while typing?
{
Thiscodeallowsyoutoreplacesumlauts(i.e.'','',etc.)
with'ae','oe',etc.whiletyping.
MitdiesemCodekannmanUmlautzeichen(,,usw.)durch
ae,oeusw.ersetzen.Diesgeschiehtapplikationsweit,whrendderEingabe.
}
procedureTForm1.AppOnMessage(varMsg:TMsg;varHandled:Boolean);
type
TReplacement=record
chIn:Char;
chOut:string[2]
end;
TReplacements=array[0..6]ofTReplacement;
const
Replacements:TReplacements=((chIn:'';chOut:'ae'),
(chIn:'';chOut:'oe'),
(chIn:'';chOut:'ue'),
(chIn:'';chOut:'Ae'),
(chIn:'';chOut:'Oe'),
(chIn:'';chOut:'Ue'),
(chIn:'';chOut:'ss'));
var
i:Integer;
c:Char;
begin
Handled:=False;
ifMsg.Message=WM_CHARthen
begin
ifChr(Msg.wParam)in['','','','','','','']then
begin
fori:=Low(Replacements)toHigh(Replacements)do
ifChr(Msg.wParam)=Replacements[i].chInthen
begin
Msg.wParam:=Ord(Replacements[i].chOut[1]);
withLongrec(Msg.lParam)do
Hi:=(Hiand$FF00)orVKKeyScan(Replacements[i].chOut[2]);
PostMessage(Msg.hwnd,WM_CHAR,Ord(Replacements[i].chOut[2]),
Msg.wParam);
withLongrec(Msg.lParam)do
Hi:=(Hiand$FF00)orVKKeyScan(Char(Msg.wParam));
Break;
end;
end;
end;
end;
procedureTForm1.FormCreate(Sender:TObject);
begin
Application.OnMessage:=AppOnMessage;
end;