Link to home
Start Free TrialLog in
Avatar of vkani
vkaniFlag for India

asked on

How to close FTP connection using INET control?

I'm transferring some files through a dial-up Connection (FTP) using internet transfer control in my application. I'm establishing (and disconnecting) the dialup connection separately(outside my application) . What should I do to do it within my application? If I set the Internet Explorer settings as 'Dial whenever a network connection is not present' or 'Always dial my default connection', then I'm able to connect the dialup within the application. How can I change the settings of the Internet Explorer programmatically? What should I do to disconnect the connection during runtime? ( I tried the method 'Inet1.execute , "Quit" ' .But it doesnt close the connection.) Is there any way to create a new dialup connection using VB code?
ASKER CERTIFIED SOLUTION
Avatar of edwardiii
edwardiii

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of edwardiii
edwardiii

Regarding your question about changing the IE settings programmatically, I'm not finding that code on the 'Net.  But, if you use the method above, you'll connect no matter what someone's IE settings are.  A link with several methods to determine if you are connected via a dial-up connection is here:

http://www.vbcity.com/forums/faq.asp?fid=10&cat=Networking#TID15802
Avatar of vkani

ASKER

Hi Edwardii,
Thanks for your answer.Your code for disconnection works with a slight change:


instead of


You've not answered the last line of my question.(Creating a new dialup connection without using the 'network connections' wizard)

I'll accept your answer irrespective of your response for this, as you've already relieved me of the major problems! Thanks a lot!
Avatar of vkani

ASKER

The correction in your code for disconnection goes like this:
         InternetHangUp HandleConnection,0&
instead of
        InternetHangUp Me.hWnd, HandleConnection.
I'm glad to have helped, vkani.  Thank you very much for sharing the working code to disconnect a dial-up connection:)  It appears that creating a new dial up connection on the fly is more involved than running a line or two of code.  It deals with RAS, which I've not worked with.  You may find what you need by searching this forum for "New dial-up connection"; this link also looks promising:

     http://www.freevbcode.com/ShowCode.asp?ID=1674