Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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
  #1 (permalink)  
Old April 12th, 2007, 11:19 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default closing an inet1 connection

Hi,
I am downloading files, through inet1 ftp. I want to close a conenction , on clicking of a button cancel. However I do get errors such as Still executing last request. Please help me with this. it is urgent.
some part of code, i tried all the methods,

If Inet1.StillExecuting = True Then
            FinishCmd
            Inet1.Execute , "QUIT"
            FinishCmd
                Inet1.Cancel
                'FinishCmd
                Inet1.Execute , "CLOSE"
                FinishCmd
            Else
                Inet1.Cancel
                'FinishCmd
                Inet1.Execute , "CLOSE"
                FinishCmd

            End If

Public Sub FinishCmd()
    Do While frmBackUp.Inet1.StillExecuting
        DoEvents
    Loop
End Sub

  #2 (permalink)  
Old April 13th, 2007, 01:33 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

:D

Just a thought....

when StillExecuting is TRUE, it will not respond to other commends that has been sent. So rather than checking the condition for true or false... its better you call Inet1.Cancel = True and this should work. If still this doesn't makes any sense then try setting the time-out property for lesser time then it is. So the execution must stop after that particular amount of time.

(hope this helps)

With Regards,
Raghavendra Mudugal
  #3 (permalink)  
Old April 14th, 2007, 08:46 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Inet1.cancel= true does not work. And it is just Inet1.cancel. I have not set any timeout property.

  #4 (permalink)  
Old April 15th, 2007, 02:05 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, Inet1.Cancel is the way... my point is.. like when you call Cancel method, it is setting True (internally) and that should work... So if this is not working then, timeout might help... its Inet1.RequestTimeout = <value> (0 = infinity). Okay try this....

Btw:
For proper functionality on FTP or HTTP, Inet1 is not the right thing... you have to use wininet.dll and classes provided by it.

With Regards,
Raghavendra Mudugal
  #5 (permalink)  
Old April 15th, 2007, 02:34 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

also... check this link below on WinInet stuff... (it gives you some idea)

http://p2p.wrox.com/topic.asp?TOPIC_ID=54850

With Regards,
Raghavendra Mudugal
  #6 (permalink)  
Old April 17th, 2007, 09:31 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks But my whole code is in Inet1 and cannot change at this stage. Ur code is good. thanks.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing Files Apocolypse2005 Beginning VB 6 3 August 21st, 2007 02:17 PM
Closing an ADO connection to a .DBF file tknnguyen Pro VB 6 2 July 25th, 2007 01:49 PM
browser closing vamsivaila Pro Java 0 January 3rd, 2007 06:43 AM
Closing Database Connection chrscote Classic ASP Databases 3 June 2nd, 2005 08:29 AM





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