Recent

Author Topic: [SOLVED] Windows PIPES (Again)  (Read 174 times)

pcurtis

  • Full Member
  • ***
  • Posts: 124
[SOLVED] Windows PIPES (Again)
« on: August 01, 2020, 09:06:40 am »
Hello All,

I create a process with the following code

Code: Pascal  [Select][+][-]
  1.   MyShell := TProcess.Create(nil);
  2.      with MyShell do
  3.        begin
  4.          Options := Options + [poUsePipes];
  5.          Executable:='mpv.exe';
  6.          ShowWindow:=swoHIDE;
  7.          Parameters.Add('--wid');
  8.          Parameters.Add(inttostr(Panel1.Handle));
  9.          Parameters.Add('--no-terminal');
  10.          Parameters.Add('--input-ipc-server=\\.\pipe\mpv-pipe');
  11.          Parameters.Add('--config-dir=c:\work\');
  12.          Parameters.Add('S01E01.mp4');
  13.          Execute;
  14.        end;
  15.  

I then create a separate program with the following code

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   command : string;
  4. begin
  5.   command:='cycle pause';
  6.  
  7.    with TFilestream.Create('\\.\pipe\mpv-pipe', fmOpenWrite) do
  8.   try
  9.     WriteBuffer(command[1], command.length);
  10.   finally
  11.     Free;
  12.   end;
  13. end;
  14.  

And I can control the first program. Great.

My problem is this. If I add button and the above onclick event to the first program, it doesn't control the program.

Any ideas?

Thanks in advance.
« Last Edit: August 01, 2020, 10:50:17 am by pcurtis »
Windows 10 / Linux Mint 20
Laz 2.0.8
FPC 3.0.4

pcurtis

  • Full Member
  • ***
  • Posts: 124
Re: [SOLVED] Windows PIPES (Again)
« Reply #1 on: August 01, 2020, 10:51:55 am »
My mistake, forgot to append command with CRLF
Windows 10 / Linux Mint 20
Laz 2.0.8
FPC 3.0.4

 

TinyPortal © 2005-2018