如何 运行 命令行程序并在 运行 在 Delphi 中发送密钥?
How to run a command-line program and send keys while running in Delphi?
我可以使用以下命令打开命令行程序:
ShellExecute(Handle, 'open', 'example.exe', nil, nil, SW_SHOWNORMAL) ;
程序等待用户输入(例如按键"q")。我如何在 运行 时向程序发送密钥?
根据 Uwe Raabe 的建议,
DosCommand1.CommandLine:='example.exe';
DosCommand1.Execute;
...
DosCommand1.SendLine('q',True);
我可以使用以下命令打开命令行程序:
ShellExecute(Handle, 'open', 'example.exe', nil, nil, SW_SHOWNORMAL) ;
程序等待用户输入(例如按键"q")。我如何在 运行 时向程序发送密钥?
根据 Uwe Raabe 的建议,
DosCommand1.CommandLine:='example.exe';
DosCommand1.Execute;
...
DosCommand1.SendLine('q',True);