Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 25th, 2009, 11:48 AM
Authorized User
 
Join Date: Jul 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default API FTP.exe

Greetings, I wasn't sure where to put this since I didn't see an api forum.

I'm not implementing this particular code in VB, but it's all api, so it shouldn't matter, should it?

I want to use FTP.exe through createprocess api so that I can implement waitforsingleobject.

Here is my command:

Code:
createprocess("c:\winnt\system32\cmd.exe","c:\winnt\system32\cmd.exe /C c:\winnt\system32\ftp.exe -i -s:ftpscript.txt > c:\temp\ftp.out"), 0,0,0,0,0, sys(5)+sys(2003),@lcStartupInfo, @lcProcInfo)
I'm using cmd.exe cause I want to pipe output. The ftp.out file has the following in it:
ftpscript.txt contains:
open IPAddress
username
password
binary
put bob.xls
bye

ftp.out contains:
ftp> ftp>
ftp> open IPAddress
Invalid command.
ftp> Username
Invalid command.
ftp> password
Not connected.
ftp> binary
Not connected.
ftp> put bob.xls
bye

This works without createprocess, but then I can't use WaitForSingleObject, right?

Thanks
 
Old June 25th, 2009, 10:45 PM
Authorized User
 
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts
Default

As long as you have a handle to the process (CreateProcess, ShellExecute, etc.) you can use the WaitForSingleObject to wait upon the process.

Good Luck
 
Old June 26th, 2009, 04:33 PM
Authorized User
 
Join Date: Jul 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by vb5prgrmr View Post
As long as you have a handle to the process (CreateProcess, ShellExecute, etc.) you can use the WaitForSingleObject to wait upon the process.

Good Luck
I didn't think you could do this with shellexecute because it doesn't return a handle to the process.
 
Old June 27th, 2009, 10:31 PM
Authorized User
 
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Opps... Sorry... followed by FindWindow. Forgot that when looked at example and wrote reply.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do API Declarations Incr. .EXE size? BrianWren Pro VB 6 6 December 21st, 2007 03:23 PM
API for Secure FTP (SFTP/SSH) redbudval Pro VB.NET 2002/2003 2 December 7th, 2007 06:27 PM
Membership: aspnet_sql.exe -> aspnet_regsql.exe ricpue BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 August 9th, 2006 11:40 PM
problem creating .exe from MFC AppWizard(exe) c++ method Visual C++ 0 July 7th, 2006 03:28 AM
running an .exe API without installing a service taunon C# 0 June 10th, 2006 09:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.