Hi
I have an external consoleapplication that i want to control with a Windows program, Lazarus application.
I have tried using TProcess with no success. Can this be done with TProcess or is there another way to do this in Lazarus or is Windows API what i should use. I want the external consoleapplication to react on a keystroke, like F1.
Im starting the external consoleapplication with this code:
procedure TForm1.Button1Click(Sender: TObject);
begin
Aprocess.Executable:=Path+'program.exe';
Aprocess.Options:=AProcess.Options+[poUsePipes, poStderrToOutPut];
Aprocess.Execute;
end;
I try to send the keystroke to the external consoleapplication with this code:
procedure TForm1.Button2Click(Sender: TObject);
var str:string;
begin
str:=inttostr(VK_F1)+LineEnding;
AProcess.Input.Write(str[1], Length(str));
end;
I have tried some other str settings as well but with no success, the external consoleapplication is not responding.
What str setting do i need to use, is this the right way or should this be done in another way?
/GannTrader