PDA

View Full Version : Programming Help


Draft Dodger
01-25-2004, 07:48 PM
been trying to figure out something that should be relatively simple to do. Using VB (.Net), but this is a pretty basic program - if someone can show me how to do what I want to do in one of the C languages, I could probably muddle through the rest.

basically, I want to automate the process of saving an internet picture to my hard drive. I know how to open a picture from a path on my hard drive, but I can't make it work with an internet link...

for example:


pic1.image = Image.FromFile("path of the file")


if the path is a path to where the picture is on my hard drive (S:\Graphics), the program works fine. I want to change that to an internet path (http://www.google.com/images/logo.gif), but if I do so I get an error. I'm sure there's a relatively simple way to do this, but it's eluding me - and a search through some books and online stuff hasn't helped me. I'm assuming that the "FromFile" part of the code is wrong, but I can't find anything else that may be a suitable replacement.

thanks in advance if anyone's able to point me in the right direction...

Chubby
01-25-2004, 07:51 PM
seriously, right click and save file... it still only takes one hand to do that ;)

Draft Dodger
01-25-2004, 07:53 PM
seriously, right click and save file... it still only takes one hand to do that ;)

it's a couple thousand files (to use for a new facepack set). making a simple program to automate that process will save me a TON of time.

Chubby
01-25-2004, 07:54 PM
it's a couple thousand files (to use for a new facepack set). making a simple program to automate that process will save me a TON of time.


hmm yes that would suck then.

Fido
01-26-2004, 07:49 AM
Do you know the names of all of the files you want to download or are you looking for a wildcard approach?

You are not able to do it the way you are trying because you are asking VB to automatically establish a connectin to the web server for you. This works fine ine IE because IE is a web client and makes the connection. VB doesn't have that capability so you can't do it directly.

If you know the names of the files you want to grab, then http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/reference/functions/urldownloadtofile.asp is what you are looking for.

If you want wild cards, then its a bit more work. You'll need to gram the html pages, and parse through them for the IMG tags, then download those.

Draft Dodger
01-26-2004, 08:39 AM
Do you know the names of all of the files you want to download or are you looking for a wildcard approach?

You are not able to do it the way you are trying because you are asking VB to automatically establish a connectin to the web server for you. This works fine ine IE because IE is a web client and makes the connection. VB doesn't have that capability so you can't do it directly.

If you know the names of the files you want to grab, then http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/reference/functions/urldownloadtofile.asp is what you are looking for.

If you want wild cards, then its a bit more work. You'll need to gram the html pages, and parse through them for the IMG tags, then download those.

thankfully, I do know the file names. many thanks Dave - that should get me back on track.