uses windows;
function SendKeys(ClassOrCaption

Char;Keys:array of Integer):Boolean;
var
hW:HWND;
Ix:Integer;
begin
hW:=FindWindow(ClassOrCaption,nil);
if hW<=0 then hW:=FindWindow(nil,ClassOrCaption);
Result:=hW>0;
if Result then begin
Result:=SetForeGroundWindow(hW);
if not Result then Exit;
for Ix:=0 to High(Keys) do KeyBd_Event(Keys[Ix], 0, 0, 0);
for Ix:=High(Keys) downto 0 do Keybd_Event(Keys[Ix], 0, KEYEVENTF_KEYUP, 0);
end;
end;
//Örne