Welcome. Just wish I could find you the good version of that, but it seems
to have disappeared from my archives. The good version of it used named
pipes instead of a disk file. I resorted to named pipes in the end because
GetTempPath would fail on some (10%) of the server systems I encountered
Rich Cooper wrote:
snipz
Does anyone have a way to determine whether the file HARBOR.TXT
has been released for reading after being completely written? I would
be able to fix this problem by replacing the Sleep(500) with a loop
that tests till the HARBOR.TXT file is ready for reading, having
Stephen Posey wrote:
Rich Cooper wrote:
Thanks Stephen,
I found a web page with a similar snippet, and so I was able to
get the following to work in my OnFormCreate handler:
D := GetStartDir;
ShellExecute( 0, 'open', PChar('command.com'),
PChar('/c '+'ipconfig/all
I managed to set a flag, then loop on exceptions with a LoadFromFile)
until there was no exception, and that seems to solve the problem!
Thanks Sid,
Rich
Sid Gudes wrote
I haven't tried this, but probably what you can do is try to open the
file exclusively (fmShareExclusive). If it is in use
Lovely! Thanks, Jeff
-Rich
Jeff Young wrote
Rich,
Thought I'd chime in with code that I've used for the very same
process. It worked on D7... HTH.
unit Process;
interface
uses
Classes, Windows, SysUtils;
function ExecuteWait(Path, Command, Params: String; ShowWindow: Word;
Rich Cooper wrote:
Thanks Stephen,
I found a web page with a similar snippet, and so I was able to
get the following to work in my OnFormCreate handler:
D := GetStartDir;
ShellExecute( 0, 'open', PChar('command.com'),
PChar('/c '+'ipconfig/all harbor.txt'),
I haven't tried this, but probably what you can do is try to open the
file exclusively (fmShareExclusive). If it is in use by DOS, then
the open should fail. Once DOS finishes and closes the file, the
open should succeed. So something like this:
waiting := 100;
repeat
try
fs :=
Thanks Wim! I finally got it figured out.
-Rich
Wim Sterns wrote
--- Rich Cooper wrote:
I'm trying to pipe a DOS command to a file using a
ShellExecute,
but it doesn't create the output file. Here's the
Rich,
try
pchar('d:\harbor.txt'),nil,pchar('d:\')
Wim
code:
Rich Cooper wrote:
I'm trying to pipe a DOS command to a file using a ShellExecute,
but it doesn't create the output file. Here's the code:
var D : string;
...
D := GetStartDir;
ShellExecute(0,pChar('ipconfig/all
'),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL);
...
but no
Thanks Rob,
But actually, I did get one to work. It finally gelled for the following
code in my OnFormCreate handler:
D := GetStartDir;
ShellExecute( 0, 'open', PChar('command.com'),
PChar('/c '+'ipconfig/all harbor.txt'),
nil, SW_HIDE );
Waiting := 100;
Thanks Stephen,
I found a web page with a similar snippet, and so I was able to
get the following to work in my OnFormCreate handler:
D := GetStartDir;
ShellExecute( 0, 'open', PChar('command.com'),
PChar('/c '+'ipconfig/all harbor.txt'),
nil, SW_HIDE );
I'm trying to pipe a DOS command to a file using a ShellExecute,
but it doesn't create the output file. Here's the code:
var D : string;
...
D := GetStartDir;
ShellExecute(0,pChar('ipconfig/all
'),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL);
...
but no file named 'harbor.txt' gets
12 matches
Mail list logo