limelect 48 Posted December 3, 2023 (edited) I just want to open webcam setting with Delphi window 7 just code plz Edited December 3, 2023 by limelect Share this post Link to post
limelect 48 Posted December 3, 2023 I found this project https://github.com/jpalbert/webcam-settings-dialog-windows I changed the bat to chcp 65001 > nul ffmpeg -f dshow -show_video_device_dialog true -i video="Integrated Camera" and it works however, doing the same with Delphi does not work as I have GetDosOutput that does not do the job Any idea how to do this with Delphi? GetDosOutput works when I read info from a program I tried to delete the repeat section Any other Dos reading? procedure TForm1.GetDosOutput(CommandLine: string); const ReadBuffer = 32768; // 32kb buffer var SA: TSecurityAttributes; SI: TStartupInfo; PI: TProcessInformation; StdOutPipeRead, StdOutPipeWrite: THandle; WasOK: Boolean; Buffer: array[0..ReadBuffer] of AnsiChar; BytesRead: Cardinal; Handle: Boolean; Apprunning: DWord; // T: Ttime; TotalBytesRead, ExitCode: DWORD; BytesLeftThisMessage, TotalBytesAvail: integer; par_s: string; begin // Result := ''; Application.ProcessMessages; with SA do begin nLength := SizeOf(SA); bInheritHandle := True; lpSecurityDescriptor := nil; end; CreatePipe(StdOutPipeRead, StdOutPipeWrite, @SA, 0); try with SI do begin FillChar(SI, SizeOf(SI), 0); cb := SizeOf(SI); dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES; wShowWindow := SW_HIDE; hStdInput := GetStdHandle(STD_INPUT_HANDLE); // StdOutPipeRead; don't redirect stdin hStdOutput := StdOutPipeWrite; hStdError := StdOutPipeWrite; end; try UniqueString(CommandLine); Handle := CreateProcess(nil, PChar(CommandLine), @SA, @SA, true, (CREATE_NEW_CONSOLE) or (REALTIME_PRIORITY_CLASS), // NORMAL_PRIORITY_CLASS, nil, // PChar(WorkDir), nil, sI, PI); except end; CloseHandle(StdOutPipeWrite); begin repeat Apprunning := WaitForSingleObject(PI.hProcess, 100); Application.ProcessMessages; until (Apprunning <> WAIT_TIMEOUT) { or (stop2)}; repeat if PeekNamedPipe(StdOutPipeRead, @Buffer[0], ReadBuffer, @BytesRead, @TotalBytesAvail, @BytesLeftThisMessage) then if BytesRead > 0 then begin // ReadFile(ReadPipe,Buffer[0], ReadBuffer,BytesRead,nil) ; WasOK := ReadFile(StdOutPipeRead, Buffer[0], BytesRead, BytesRead, nil); if BytesRead > 0 then begin Buffer[BytesRead] := #0; OemToAnsi(Buffer, Buffer); par_s := StrPas(Buffer); if par_s <> '' then Memo1.Lines.Add(par_s); end; end; until (BytesRead > 0) {or (stop2)}; // < ReadBuffer) ; end; finally // stop2 := false; CloseHandle(PI.hThread); CloseHandle(PI.hProcess); CloseHandle(StdOutPipeRead); // GoToFirstLine; end; end; Share this post Link to post
limelect 48 Posted December 9, 2023 (edited) Ok I did it for how see the last section of the page https://en.delphipraxis.net/topic/10649-dspack/?tab=comments#comment-84694 Edited December 9, 2023 by limelect Share this post Link to post