|
-
November 9th, 1999, 05:15 AM
#1
How to use "FtpFindFirstFile" API ?
Hi,
I want to check whether the files have downloaded properly, for that I need to check the file size of both the files ( ie. the local file and the file in the FTP server).
I need to pass the file name and then I need to get the file size.
I have used it as :
Dim Connect As Long, Session As Long
Dim Check As Boolean, retVal As Long
Dim FFFile As WIN32_FIND_DATA
Dim FName As String
Connect = InternetOpen("MyFTPControl", 1, vbNullString, vbNullString, 0)
Session = InternetConnect(Connect, txtHost, 0, txtUser, txtPass, 1, 0, 0)
If Session = 0 Then GoTo ErrHandler
Check = FtpSetCurrentDirectory(Session, "/outbox/backup" + vbNullString)
If Check = False Then GoTo ErrHandler
'FFFile.cFileName = "AR1011.tif" & vbNullString
FName = "ar1011.tif" & vbNullString
retVal = FtpFindFirstFile(Session, FName, _
FFFile, 0, 0)
If retVal = 0 Then GoTo ErrHandler '(*)
If retVal > 0 Then 'statusFileSize > 0 Then
' doing the necessary action
End If
I am geting the error at (*) this marked line.
I am not able to get the exact syntax and the values of the parameters that this FtpFindFirstFile API takes. Can any one help me in this?
Thanx in advance.
Britto
-
November 9th, 1999, 05:23 AM
#2
Re: How to use "FtpFindFirstFile" API ?
I'd pass Err.lastDLLError to the FormatMessage API after calling FtpFindFirst... to get a human-readable explanation of the error code.
That's better than guessing ;-)
-
November 9th, 1999, 06:13 AM
#3
Re: How to use "FtpFindFirstFile" API ?
Hi
In my ErrHandler I have written the following code:
Dim ErrNo As Long
Dim lFmtMsg As Long
Dim errMsg As String
ErrNo = Err.LastDllError
errMsg = Space(1024)
lFmtMsg = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, ByVal 0&, _
ErrNo, 0&, errMsg, Len(errMsg), ByVal 0&)
MsgBox "Error No :" & ErrNo & vbNewLine & "Error Msg :" & errMsg
The error number is 12003 and no error message. Can you cay what can be the errro message and any way to rectify it.
Thanx.
Britto
-
November 9th, 1999, 06:16 AM
#4
Re: How to use "FtpFindFirstFile" API ?
That's an extended error from the WinInet DLL - take a look at my code sample at http://codeguru.developer.com/vb/articles/1852.shtml - it shows how to handle that error and others that can be generated from the DLL.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|