Jak mozna przekazac np tekst do innego okna ktorego mamy uchwyt?
ort! juz kilkoma sposobami.
<ort>Przesz </ort>CreateProcess pozniej writefile
przez <ort>shellexute </ort>pozniej <ort>findwindom </ort>i writefile
i nic nie skutkuje.
Chodzi mi o to ze np otwieram przez program cmd.exe (ktore z zalozenia pozniej nie bedzie sie <ort>w ogóle</ort> pokazywalo ->sw_hide) i wpisuje w nim komendy (nie musze nic odczytywac jak na razie).
pokaze co znalazlem w necie (program sie wiesza)
procedure TForm1.FormCreate(Sender: TObject);
const
BufSize = 16384;
var
RHandle,WHandle: THandle;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation;
ReadBuf: Array[0..BufSize] of Char;
BytesRead,Wynik,BytesWriten:cardinal;
WriteHandle, ReadHandle: THandle;
begin
FillChar(StartupInfo,SizeOf(StartupInfo), 0);
CreatePipe(RHandle, WriteHandle, nil, 0);
CreatePipe(ReadHandle, WHandle, nil, 0);
with StartupInfo do
begin
cb:= SizeOf(StartupInfo);
dwFlags:= STARTF_USESTDHANDLES;
hStdOutput:= WriteHandle;
hStdError:= WriteHandle;
hStdInput:=ReadHandle;
wShowWindow:= SW_show;
end;
if not CreateProcess(nil, PChar('c:\windows\system32\cmd.exe'), nil, nil,
false, DETACHED_PROCESS or NORMAL_PRIORITY_CLASS,
nil, nil, StartupInfo, ProcessInfo) then
begin
CloseHandle(RHandle);
CloseHandle(ReadHandle);
Exit;
end;
Wynik:=WaitForSingleObject(RHandle,1);
if Wynik<>WAIT_TIMEOUT then
begin
ReadFile(RHandle, ReadBuf, BufSize,BytesRead,nil);
if BytesRead>0 then begin
Memo1.Lines.Add(ReadBuf)
end;
TerminateProcess(Processinfo.hProcess, 255);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
CloseHandle(RHandle);
CloseHandle(ReadHandle);
end;
end;
end.
moze ktos wie jak sobie z tym poradzic
// 1. popraw orty; 2. nie wklejaj nadmiarowego kodu; 3. stosuj znaczniki < delphi> do kodu - ŁF