473,785 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INET problem

Hi,
I am using Inet AcitveX to download a file form Http.(code below) but
couldnot able to download. The file size is about 2MB.
Please Suggest.

Thanks

Code

Private Sub Command1_Click( )
Inet1.Protocol = icHTTP
Inet1.OpenURL Http://hostname/hi.exe
Inet1.Execute , "GET Hi.exe c:\Hi.exe"
End Sub

Private Sub Inet1_StateChan ged(ByVal State As Integer)
Const lCHUNKSIZE As Long = 1024
Dim vtData As Variant ' Data variable.

Text1.Text = State 'For checking only

Select Case State
Case icError ' 11
vtData = Inet1.ResponseC ode & ":" & _
Inet1.ResponseI nfo

Case icResponseCompl eted ' 12
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False

' Get first chunk.
vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
DoEvents

Do While Not bDone

strData = strData & vtData
' Get next chunk.
vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
DoEvents

If Len(vtData) = 0 Then
bDone = True
End If
Loop

Case icDisconnected
Debug.Print "* Disconnected"
Unload Me

End Select
End Sub
Jul 17 '05 #1
2 13155
Looks more like you're attempting FTP than HTTP. The line that
says: Inet1.Execute , "GET Hi.exe c:\Hi.exe" is a dead giveaway.
It should be more like: buffer() = Inet1.OpenURL(f ileURL, icByteArray)
thus GETting the file into byte array "buffer()".

"Kapish Kalda" <ka****@synergi x.com> wrote in message
news:91******** *************** ***@posting.goo gle.com...
Hi,
I am using Inet AcitveX to download a file form Http.(code below) but
couldnot able to download. The file size is about 2MB.
Please Suggest.

Thanks

Code

Private Sub Command1_Click( )
Inet1.Protocol = icHTTP
Inet1.OpenURL Http://hostname/hi.exe
Inet1.Execute , "GET Hi.exe c:\Hi.exe"
End Sub

Private Sub Inet1_StateChan ged(ByVal State As Integer)
Const lCHUNKSIZE As Long = 1024
Dim vtData As Variant ' Data variable.

Text1.Text = State 'For checking only

Select Case State
Case icError ' 11
vtData = Inet1.ResponseC ode & ":" & _
Inet1.ResponseI nfo

Case icResponseCompl eted ' 12
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False

' Get first chunk.
vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
DoEvents

Do While Not bDone

strData = strData & vtData
' Get next chunk.
vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
DoEvents

If Len(vtData) = 0 Then
bDone = True
End If
Loop

Case icDisconnected
Debug.Print "* Disconnected"
Unload Me

End Select
End Sub

Jul 17 '05 #2
try this, it worked for me.

Private Sub Command1_Click( )
Dim file As Byte
file = Inet1.OpenURL(" Http://hostname/hi.exe", icByteArray)
Open "C:\Hi.exe" For Binary Access Write As #1
Put #1, , file
Close #1
End Sub
"Kapish Kalda" <ka****@synergi x.com> wrote in message
news:91******** *************** ***@posting.goo gle.com...
Hi,
I am using Inet AcitveX to download a file form Http.(code below) but
couldnot able to download. The file size is about 2MB.
Please Suggest.

Thanks

Code

Private Sub Command1_Click( )
Inet1.Protocol = icHTTP
Inet1.OpenURL Http://hostname/hi.exe
Inet1.Execute , "GET Hi.exe c:\Hi.exe"
End Sub

Private Sub Inet1_StateChan ged(ByVal State As Integer)
Const lCHUNKSIZE As Long = 1024
Dim vtData As Variant ' Data variable.

Text1.Text = State 'For checking only

Select Case State
Case icError ' 11
vtData = Inet1.ResponseC ode & ":" & _
Inet1.ResponseI nfo

Case icResponseCompl eted ' 12
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False

' Get first chunk.
vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
DoEvents

Do While Not bDone

strData = strData & vtData
' Get next chunk.
vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
DoEvents

If Len(vtData) = 0 Then
bDone = True
End If
Loop

Case icDisconnected
Debug.Print "* Disconnected"
Unload Me

End Select
End Sub

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6081
by: Laphan | last post by:
Hi All Just wanted to know if anybody knows the answer to the following quick queries: 1) The reason I'm using VB's INET control is to download copies of Ms Access DBs on a range of web sites so that I have a backup. Found out from my ISP that if my DBs go up the spout then it's down to me to restore - gulp!!! I've created a little FTP gizmo where I could download web pages OK, but not
0
4964
by: dartszeeland.tk | last post by:
Hi, i want to upload a file from my computer to a ftp..... this is the code: Inet.RemoteHost = "localhost" '(not ftp:// in front of it) Inet.RemotePort = "21" Inet.UserName = "user" Inet.Password = "password"
4
8376
by: Steen Gellett | last post by:
Hallo.....I have programmed with winsock for a while, but now I have set my eyes on Inet, but I'm totally blank........a few questions ?? Inet1.Protocol = icFTP......................I can see what this is Inet1.RemotePort = Text4.Text......... Whats the use ?? Inet1.URL = Text1.Text....................Can this be an IP adresse Inet1.UserName = Text2.Text........... I guess thats to connect to FTP Inet1.Password = Text3.Text............ I...
4
13892
by: S.W. Rasmussen | last post by:
I have tried several times to get inet.execute to download a file with the icHTTP protocol without much success so far. I execute: Inet.Execute "http://www.domain/myfolder/myfile.file", "GET" monitor the progress in Inet_StateChanged(ByVal State ByVal Integer)
0
3208
by: jtmerch | last post by:
what's the best option for using the Inet control in VB.net? Is there a control that's built for the .net framework that's similar to or better than the old Inet control? I'm opening a URL and port and passing data to that URL and port. The inet control worked fine in VB 6 for this, any ideas on VB.net? Thanks for any help.
0
5421
by: Pius | last post by:
Set Inet = Server.CreateObject("InetCtls.Inet.1") Inet.URL = "http://www.yahoo.com/" Inet.AccessType = icDirect Inet.Protocol = icHTTP Inet.RemotePort = 80 Inet.RequestTimeout = 60 response.write(Inet.ResponseCode) I got this piece of code from some forum on the web. The responsecode is supposed to return whether the connection is sucessful (ie. got a
2
2391
by: Dan | last post by:
I developed a website that posts data to another url via the Inet object. I should mention that the posting code is wrapped in a VB 6 dll, and that dll is called from ASP. Here's the ASP code: <% Dim objPostWrapper Set objPostWrapper = Server.CreateObject("MyDLL.PostWrapper")
8
2491
by: golfchick | last post by:
Well im at the end of my teather, ive been searching for an answer to no avail. Ive used suggested html and css checkers both say my code is perfect and yet there seems to be a distinct difference between both firefox and internet explorer. The problem is with the links on the left hand side, inet explorer spaces them when it shouldnt and doesnt position them where ive said too in Dreamweaver and firefox hasnt positioned them right either but...
8
5741
by: kardon33 | last post by:
Currently i am working on a project to send a UDP packet through the ArtNet protocol and receive a message back and read and output it. right now i can send the message fine and the device i send it to responds but i cant read the packet and out put the datagram. My code looks like this: #!/usr/bin/perl print "Content-type:text/html\n\n"; use IO::Socket; #use strict; my $ID = 'Art-Net';
0
2571
by: leoce7 | last post by:
I'm trying to write a macro in excel 2003 to use the "Microsoft Internet Control' reference library to access data from a web page. The problem is that it won't let me dimensionalize Inet controls even though I have added the reference ... i.e "Dim inet1 as Inet" is not allowed. Does anybody have any experience with Inet controls through excel?
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.