Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inet Still Executing never goes false

Status
Not open for further replies.

kbWilliamson

Programmer
Feb 28, 2002
18
US
I'm trying to automate a FTP transfer of files from a Windows PC into our VMS system via our network. If I use the code below, without the loop counter, the Inet1.StillExecuting never goes "false". If I put in a loop counter to exit the time delay loop and use the message box, it will loop just fine and the files go where I want them. If I leave in the loop counter and take out the message box, it gives a "Still executing" error. This will occure no matter how great the value of the loop counter. When is the "StillExecuting" property supposed to change?

The code is below...please help

Public Sub XferFTP()
Inet1.Protocol = 2 'icFTP
Inet1.URL = "##.#.#.##"
Inet1.UserName = "ANON"
Inet1.Password = "BLIND"
Dim LocalFile As String
Dim RemoteFile As String
Dim CmdStr As String
Dim GoNow As Boolean
Dim I As Long
Dim Marker As String
Marker = "XXXXXXXXXXX" 'Just something to fill the For loop
pintFTPCnt = pintFTPCnt - 1
Do While pintFTPCnt > 0
LocalFile = pstrDayDir & "\" & pstrFTPFile(pintFTPCnt) 'Build file name from array
RemoteFile = pstrFTPFile(pintFTPCnt)
GoNow = False
CmdStr = "SEND " & LocalFile & " " & RemoteFile
Inet1.Execute , CmdStr
Dim Test As Long
Test = 0
Do While GoNow = False
If Inet1.StillExecuting = True Then
For I = 0 To 15000
Marker = Marker
Next
Else
Inet1.Cancel
GoNow = True
End If
If Test >= 5000 then 'This is the loop counter. If not here loop never ends.
GoNow = True
Else
Test = Test + 1
End If
Loop
Inet1.Cancel
pintFTPCnt = pintFTPCnt - 1
MsgBox "Number " & pintFTPCnt & " loaded. Executing is " & Inet1.StillExecuting
' line above shows "Executing is True"
Loop
End Sub
 
I saw a similar question about the webbrowser object on a post, while searching the archives.

Try putting a "DoEvents" call right before the Inet1.stillexecuting.
Code:
Do While GoNow = False
  DoEvents
  If Inet1.StillExecuting = True Then
[code]
This will give the system (I assume) a chance to do the work.
 
I would do two things.

First, I would replace you for loop with the marker with a DoEvents.

Secondly, I would take advantage of the built-in Timeout feature of the Inet Control.

It quite possible that the FTP transaction fails to complete because the VMS machine is not responding. You will need to timeout to handle that situation.
Good Luck
------------
Select * from Users where Clue > 0
0 rows returned
 
Thanks Folks... it was definately the "DoEvents" that was missing... some times you can't see the forest.....
 
I use the STATE_CHANGED event along with similiar code by kavius. Are you familiar with this event? If not go to the microsoft knowledge base and you will find a good example there!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top