Wrox Programmer Forums
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro 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 December 3rd, 2005, 03:29 PM
Registered User
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default HTTP connection in VB6

I would like to find out how to make an http connection from VB6 without using a built in module. I just wan't code, an api call and function if possible. I need to be able to download a file from an in house site at work with out making the end user do anything. I have searched but everything I've found has had to do with the built in module in VB6. Any tutorial site that has this info would be helpful to.

Thanks in advance.

blizeach over and out!
Old December 4th, 2005, 02:51 AM
Registered User
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

Never mind everyone I found what I need. Guess I didn't search hard enough. LOL
Answer: http://www.devx.com/vb2themax/Tip/18669
For anyone who is interested here is the code:

Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, _
    ByVal szFileName As String, ByVal dwReserved As Long, _
    ByVal lpfnCB As Long) As Long

Private Sub Command1_Click()
' Note that this file is 2M, so you might want to try with something simpler
Dim errcode As Long
Dim url As String
Dim localFileName As String

url = "http://www.vb2themax.com/vbmaximizer/files/vbm_demo.zip"
localFileName = "c:\vbm_demo.zip"

errcode = URLDownloadToFile(0, url, localFileName, 0, 0)
If errcode = 0 Then
    MsgBox "Download ok"
    MsgBox "Error while downloading"
End If
End Sub

This works with ftp as well as long as its anonymous or doesn’t need a password anyway. For example:

Thanks again to Devx.
And thank you to the people here that have helped me in the past as well.

blizeach over and out!

Similar Threads
Thread Thread Starter Forum Replies Last Post
typing abc.com opens http://abc.com and not http:/ nrlahoti ASP.NET 2.0 Professional 1 February 6th, 2008 01:43 PM
Underlying connection close problem - HTTP Send vivjohar Biztalk 0 August 22nd, 2005 11:47 AM
http://mysite.com or http://www.mysite.com anshul HTML Code Clinic 1 December 27th, 2004 03:50 PM
http://domain or http://www.domain anshul HTML Code Clinic 9 August 11th, 2004 01:09 AM
HTTP Status 405 - HTTP method GET .... nsakic Servlets 1 January 25th, 2004 04:50 PM

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