| View previous topic :: View next topic |
| Author |
Message |
Raymond175 Contributor


Joined: 24 Apr 2002 Posts: 72
|
Posted: Thu Dec 04, 2003 8:29 am Post subject: Image-loading from the internet? |
|
|
I've created a dialog as a startup program for my real application. In this dialog I want an image loaded from the internet with the latest information. This way, when the image comes from my website, everyuser can be up-to-date.
The only problem seems to be:
DIALOG ADD,BITMAP,Image,9,8,283,303,http://www.darkwebdesign.com/Gamescreen.bmp
For some reason the image will not be loaded... Does someone know why? And does someone have an alternitive?
Thanks,
Raymond |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Dec 04, 2003 8:52 am Post subject: |
|
|
You need to establish an HTTP client to download the image file to the harddisk - then you can use it
in your program.
You can plug into Windows' own Internet socket files (if you're using VDS5) or you could use a VDS
extension DLL such as VDSIPP to do the job. If you're no hardcore API programmer the latter solution
will be far easier.
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Thu Dec 04, 2003 3:34 pm Post subject: |
|
|
Hi Raymond as Dr. Dread suggested VDS can't pull images directly like you are trying. You have to first download the image and save it to disk before you can assign it.
Here is code that will do what you are trying, you will need to download the vdsipp.dll from vdsworld.com first for this to work.
Download VDSIPP.DLL
| Code: |
#define command,INTERNET
#define function,INTERNET
external vdsipp.dll,DEMO
DIALOG CREATE,Test,200,200,300,320
DIALOG ADD,BITMAP,Image,9,8,283,303
DIALOG SHOW
rem here we create a http connection to download the file
rem it is created with threads off so no events are generated
rem notice also we use the DOWNLOAD command to pull the url and then
rem we save the file in the same directory the exe is in @path(0).
rem we then destroy the http protocol as it's not needed.
INTERNET HTTP,CREATE,1
INTERNET HTTP,THREADS,1,OFF
INTERNET HTTP,DOWNLOAD,1,http://www.darkwebdesign.com/Gamescreen.bmp,@path(%0)Gamescreen.bmp
INTERNET HTTP,DESTROY,1
rem now we just set the image to the 'Image' object.
DIALOG SET,Image,@path(%0)Gamescreen.bmp
:evloop
wait event
goto @event()
:close
exit
|
|
|
| Back to top |
|
 |
noveltech Contributor

Joined: 16 Sep 2002 Posts: 105
|
Posted: Thu Dec 04, 2003 4:36 pm Post subject: Please explain the 1/0 options |
|
|
PGWARE, Please explain the 1 usage and 0 usage below.
I'm reading every thread on this forum and I am still in a fog with the various numbers being used thruout the scripts. It would help this newbie (me) a great deal. thanks, nt
| Code: |
INTERNET HTTP,CREATE,1
INTERNET HTTP,THREADS,1,OFF
INTERNET HTTP,DOWNLOAD,1,http://www.darkwebdesign.com/Gamescreen.bmp,@path(%0)Gamescreen.bmp
INTERNET HTTP,DESTROY,1
rem now we just set the image to the 'Image' object.
DIALOG SET,Image,@path(%0)Gamescreen.bmp
|
|
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Thu Dec 04, 2003 5:21 pm Post subject: |
|
|
Hello,
INTERNET HTTP,CREATE,1
the 1 above relates to the http instance to create. The vdsipp allows you to create 99 instances of all protocols, this allows you to open up 99 http connections at the same time.
It's very similar to the LIST CREATE,1 command in vds where a list is created and can then be destroyed. In the LIST CREATE,1 command you're telling vds to create a list with the identifier of 1. This lets you then use commands like LIST ADD,1,whatever to tell vds to add an item 'whatever' to the list 1.
In the above I created an instance of an http and assigned it the identifier 1, it can be any number from 1-99. Then I call other INTERNET commands telling it to use the http instance 1:
INTERNET HTTP,THREADS,1,OFF
INTERNET HTTP,DOWNLOAD,1,http://www.darkwebdesign.com/Gamescreen.bmp,@path(%0)Gamescreen.bmp
INTERNET HTTP,DESTROY,1
internet http,threads,1,off -- this tells the dll to turn threading off for the http 1 instance.
internet http,download,1,http:/....,@path(%0)gamescreen.. -- tells it to download the image and save the file, it also is using the identifier http 1.
internet http,destroy,1 -- this tells the dll to destroy the http 1 instance, this simply frees the instance and allows me to reuse it again if I want.
I could just as well used INTERNET HTTP,CREATE,56 , this would simply have created a http instance with the identifier 56, but I would then need to use 56 in each of the INTERNET HTTP commands. This number is an identifier, it sets each http instance with a number so you can operate on several http instances at the same time (similar to how you can operate on several LISTS in vds).
The @path(%0) just returns the current directory that the exe is in. %0 is a commandline variable in vds, this variable %0 holds the path and filename of the exe that is running. I just wrapped it with @path() to extract out the filepath. |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Thu Dec 04, 2003 5:39 pm Post subject: |
|
|
To further clarify I could have done this:
| Code: |
INTERNET HTTP,CREATE,1
INTERNET HTTP,THREADS,1,OFF
INTERNET HTTP,DOWNLOAD,1,http://www.whatever.com/image.gif,savedfile.gif
INTERNET HTTP,DESTROY,1
INTERNET HTTP,CREATE,2
INTERNET HTTP,THREADS,2,OFF
INTERNET HTTP,DOWNLOAD,2,http://www.whatever.com/image2.gif,savedfile2.gif
INTERNET HTTP,DESTROY,2
|
As you can see above I created 2 instances of the http protocol, I used the identifier 1 and 2 so I can sepearte/distinguish the two instances and allow both of them to download from different sites/urls. It's not necessary to open multiple instances in this example as I could have just used 1 instance and downloaded the files but this is just an example to show what the 'numbers' are used for. |
|
| Back to top |
|
 |
noveltech Contributor

Joined: 16 Sep 2002 Posts: 105
|
Posted: Thu Dec 04, 2003 8:59 pm Post subject: Thanks, PGWARE |
|
|
Thanks, PGWARE...
I understand much better. nt |
|
| Back to top |
|
 |
noveltech Contributor

Joined: 16 Sep 2002 Posts: 105
|
Posted: Thu Dec 04, 2003 10:23 pm Post subject: vdsipp.dll Question regarding this script |
|
|
Would you modify the above example to download
the http file in html format instead of bmp format
and if http is not avail or no connection event possible!...
utilize the last file download.!
Scenario:
1. The Gamescreen Bmp is located in the current exe directory.
2. The exe loads as blank dialog waiting for http connection.
3. Connection not avail
However, the previously loaded or bmp with same name
is avail in the current directory...the dialog screen does
not use it...it remains imageless!
Is there a time limit command for http download?
If not connected within x secs, use the current bmp or html.
Thanks, nt. |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Thu Dec 04, 2003 10:46 pm Post subject: |
|
|
noveltech,
I'm not sure what you mean by downloading hte file in html format instead of bmp format. The file being downloaded is a bmp, to my knowledge there is no html format for an image. If you want to download the source to a website you can use the INTERNET HTTP,GET command.
Also there are many functions such as:
@INTERNET(HTTP,RETURNCODE)
@INTERNET(HTTP,CONTENTLENGTH)
which you can use to see if the file you are trying to download is available or if you are able to even connect (no internet connection).
There is a timelimit, I can't recall off hand what it is but its almost immediate if it cannot load the file or make a connection. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|