Help,file downloader on webbrowser
hello..
i just want to create some application..
scenario:
on my project theres a webbrowser,and my custom html load on webbrowser when form load.
in my custom html there a download links of a file ex:
<a href="http://localhost/fie1.exe">file1.exe</a>
<a href="http://localhost/fie3.exe">file2.exe</a>
<a href="http://localhost/fie3.exe">file3.exe</a>
if i click the link file1.exe i just one to download it on my file downloader built in on my form.
how it works?
how to add file downloader?
my purpose is i just want to hide the links of the file that they downloading,thats why i want to add file downloader..
i can disable right click on my html using javascript so they can not view the source of html.
and i choose webbrowser so that i can update the links on my server.
anyone can help me?
thanks...
sorry for my english..
Re: Help,file downloader on webbrowser
Look at the URLDownloadToFile API...
Good Luck
Re: Help,file downloader on webbrowser
Would this help you: Includes a progress bar
Add reference to WinHTTP.dll in systems32. (Browse to it, if Microsoft WinHTTP services doesn't show on the references list.)
Note this simple example doesn't do anything fancy, just dumps the downloaded bytes to disk.
OnResponseStart when you can safely access the headers.
OnResponseDataAvailable which returns a byte array of downloaded data for each chunk.
OnResponseEnd which ends the download.
Code:
Option Explicit
Private WithEvents http As WinHttpRequest
Private mContentLength As Long
Private mProgress As Long
Private Sub Command1_Click()
' Create the WinHTTPRequest ActiveX Object.
Set http = New WinHttpRequest
' Open an HTTP connection.
http.open "GET", "http://YourWebsite/file1.exe", True 'True means asynch.
' Send the HTTP Request.
http.send
End Sub
Private Sub http_OnResponseDataAvailable(Data() As Byte)
mProgress = mProgress + UBound(Data) + 1
ProgressBar1.Value = mProgress
Put #1, , Data
End Sub
Private Sub http_OnResponseFinished()
Close #1
MsgBox "done"
End Sub
Private Sub http_OnResponseStart(ByVal Status As Long, ByVal ContentType As String)
Text1.Text = http.getAllResponseHeaders()
mProgress = 0
mContentLength = CLng(http.getResponseHeader("Content-Length"))
ProgressBar1.Max = mContentLength
Open "C:\File1.exe" For Binary As #1
End Sub
1 Attachment(s)
Re: Help,file downloader on webbrowser
thanks for your reply..
as of now i have a downloader here!i will attach here.thanks to the author of this code.
i want to add webbrowser on this form and when i click the download link i want this download get the file to download..
thanks...
Re: Help,file downloader on webbrowser
Quote:
Originally Posted by
Joke Sparrow
thanks for your reply..
as of now i have a downloader here!i will attach here.thanks to the author of this code.
i want to add webbrowser on this form and when i click the download link i want this download get the file to download..
thanks...
Don't think thats possible, but you could add borderless underlined text boxes as a hack
Re: Help,file downloader on webbrowser
hmmm...i hope it is possible..
on my html code i can put name tag of every file
<a name="file1" href="http://localhost/fie1.exe">file1.exe</a>
<a name="file1" href="http://localhost/fie3.exe">file2.exe</a>
<a name="file1" href="http://localhost/fie3.exe">file3.exe</a>
on my cmdfile1_click button
webbrowser1.navigate to my custome page
and when the page download complete it will search to a tag name file1,then get the links and put on the urltxt of downloader..
but the problem is i dont know the code...
i know on vb.net this link..http://www.vbforums.com/showthread.php?t=586821
any reply will appreciate.