Reputation: 743
I can open an external program fine with ShellExec
ret := ShellExecute(handle, 'open', PChar(filename), nil, nil, SW_NORMAL);
but then I would like to send it commands like:
msg := 'open ftp://MyUser:[email protected]';
Is this possible?
Upvotes: 1
Views: 1245
Reputation: 613572
It's possible I guess, but it's not the best way to do this. The best way is to use CreateProcess
. It's a more involved API, but it will make what you are attempting simpler.
The procedure goes like this:
CreateProcess
to create the child. Attach the read end of the first pipe to the child's standard in. Attach the write end of the second pipe to the child's standard output. This can be daunting if you are not familiar with such coding. You might do well to find a library that makes it easy.
This MSDN article demonstrates how:
Creating a Child Process with Redirected Input and Output
Since you seem to be wanting to do FTP, you'd be better off avoiding an external process. Use a library such as Indy.
Upvotes: 3