|
-
Nov 1st, 1999, 02:44 AM
#1
How can i download files from the internet Like
"www.Website.com/Progarm.exe"
-
Nov 1st, 1999, 03:21 AM
#2
Lively Member
Is it that you want to download using a program or simply download a file?
To download a file type the full path in IE address box. IE will download it for you.
To do it to vb program you have to use Inet control.
Go thro internet transfer control in vb.
-
Nov 11th, 2013, 09:17 PM
#3
Member
Re: Downloading Files/Text files From a internet address ...
Hi All,
Can I ask, how to read a textfile form the interntet. For example, www.sample.net/file.txt then display it on textbox...
-
Nov 11th, 2013, 11:38 PM
#4
Re: Downloading Files/Text files From a internet address ...
 Originally Posted by laudeniold
Hi All,
Can I ask, how to read a textfile form the interntet. For example, www.sample.net/file.txt then display it on textbox...
Here is how to read the contents on a text file and display it in a text box using the Inet Control.
Code:
Option Explicit
'Add Microsoft Internet Transfer Control
Private Sub cmdGet_Click()
Dim strVariable As String
strVariable = Inet.OpenURL("http://www.vbforums.com/attachment.php?attachmentid=74982&d=1260669911")
Text1.Text = strVariable
End Sub
Also, instead of bumping a topic that is x number of years old and is not your own please create your own topic.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Nov 12th, 2013, 12:46 AM
#5
Hyperactive Member
Re: Downloading Files/Text files From a internet address ...
i saw this posted a few weeks ago by someone asking the same and ive switched to it
in formload or behind button
Code:
svrip.Text = URLSource("http://www.mysitesname/svrip.txt")
and add a module .......with
Code:
Option Explicit
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal sURL As String, ByVal sHeaders As String, ByVal lHeadersLength As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Private Declare Function GetInputState Lib "user32" () As Long
Private Const IF_NO_CACHE_WRITE = &H4000000
Private Const BUFFER_LEN = 256
Public Function URLSource(ByRef URL As String) As String
Dim strBuffer As String * BUFFER_LEN, lonRet As Long
Dim strData As String, lonHandle As Long, lonSession As Long
Dim lonResult As Long
lonSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)
If lonSession Then lonHandle = InternetOpenUrl(lonSession, URL, vbNullString, 0, IF_NO_CACHE_WRITE, 0)
If lonHandle Then
lonResult = InternetReadFile(lonHandle, strBuffer, BUFFER_LEN, lonRet)
strData = strBuffer
Do While lonRet <> 0
lonResult = InternetReadFile(lonHandle, strBuffer, BUFFER_LEN, lonRet)
strData = strData & Mid$(strBuffer, 1, lonRet)
If GetInputState Then DoEvents
Loop
End If
lonResult = InternetCloseHandle(lonHandle)
URLSource = strData
End Function
-
Nov 12th, 2013, 12:51 AM
#6
Re: Downloading Files/Text files From a internet address ...
Seems kind of pointless when you can do it with one line with Inet
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
Nov 12th, 2013, 12:54 AM
#7
Hyperactive Member
Re: Downloading Files/Text files From a internet address ...
ive had problems with inet
-
Nov 12th, 2013, 01:19 AM
#8
Re: Downloading Files/Text files From a internet address ...
You can also use the AsyncRead method for a simple GET like this. No msinet.ocx required and no raft of API calls with busy-wait loops and crash inducing, data corrupting DoEvents calls.
Or there are at least three HTTP Request objects built into Windows you can use.
Last edited by dilettante; Nov 12th, 2013 at 02:30 AM.
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
|