[fpc-pascal] Run process and exit (win32)
L
L at z505.com
Tue Oct 23 15:31:59 CEST 2007
> > Hi, I'm trying to start a Win32 process and exit leaving the process
> > executing. The test
> > scenario
> > is a CGI calling a simple Http server (the Synapse Http server demo).
> >I have done this before but it has been months and I forget exactly what I
did.
Something like this below:
program ShellExec; {$mode objfpc}{$H+}
uses
pwumain, windows;
begin
WebWriteln(' Hello! ');
ShellExecute(0 , 'open', 'cmd /k c:\winnt\notepad.exe', nil, nil,
SW_SHOWNORMAL) ;
end.
Because cmd /k forks open a new separate cmd shell for you (not a child, AFAIK).
But test it, and let me know.
Then on unix you already know how with the ampersand, so just make a cross
platform wrapper.
I have not looked at TProcess source code and don't know if it will work for
you.. but maybe we can patch TProcess to give it some new abilities if it cannot
launch a separate process currently?
More information about the fpc-pascal
mailing list