如何将字符串发送到我在 createprocess 的帮助下打开的进程?
我在 Stackoverflow 的帮助下写了这样的东西:
var
StartUpInfo:TStartUpInfo;
ProcessInfo: TProcessInformation;
Creationflags: Cardinal;
FillChar(StartUpInfo, sizeOf(TStartupinfo),0);
StartUpInfo.cb := SizeOf(StartupInfo);
Creationflags := NORMAL_PRIORITY_CLASS;
if Createprocess(nil, Pchar('c:\program files\adobe\reader 9.0\reader\acrord32.exe'
+ ' ' + '/h /O /N /T "c:\ps\test2.pdf" "Generic printer"'),nil, nil,False,
creationflags, nil, 0 , StartUpInfo , ProcessInfo) then
begin
WaitForSingleObject(ProcessInfo.HProcess, infinite);
begin
//write some information into the process (a window that opens in
//acrobatreader) and then I want to press the enter button
end;
CloseHandle(processinfo.hProcess);
end;
所以我想要的是在进程完成时(就在waitforsingleobject之后)写一行然后按“enter”按钮,最后在完成后关闭进程。有谁知道如何与外部进程交互?在编程方面,我是一个完全的新手。
此致