create process를 사용하여 연 프로세스에 문자열을 보내려면 어떻게해야합니까? 내가 유래 여기 발견 한 것을의 도움으로 이런 일을 작성했습니다델파이 7에서 Createprocess로 연 프로세스에 문자열 또는 정보를 보내려면 어떻게합니까?
:
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 후) 완료 라인을 작성하는 것입니다 "입력"버튼을 누른 다음 작업이 끝나면 마침내 프로세스를 닫습니다. 누구나 외부 프로세스와 상호 작용하는 방법을 알고 있습니까? 프로그래밍에 관해서는 완전히 초보자입니다.
안부
키 스트로크를 편집 컨트롤에 적용하려면 WM_Down, WM_KeyPress 및 WM_KeyUp 시퀀스가 필요하지 않습니까? 그가 문자열을 보내길 원한다고 말했다. –
@JamesB OK, 나는 그 비트를 놓쳤다. SetWindowText를 사용하는 것이 더 쉬울 수도 있습니다. –