Share Tips, Code Samples, etc. with the Visual Prolog community.
Gildas Menier
Active Member
Posts: 25
Joined: 8 Jun 2004 23:01

(Howto) get an image from internet and display it (and more)

Post by Gildas Menier »

This project shows how to download a web page, parse it to extract the <img> tags (thanks to a code made by Mr Yasuhisa Matsumura and available in the examples of visual prolog). Then how to download a picture (given its URL) and make a gdi image from it and display it.

The project contains a very small subset of predicates to call wininet. This should work for CE and PE.

The code from Mr Yasuhisa Matsumara can be found there http://www.visual-prolog.com/vip6/Commu ... ToList.htm

regards

Gildas

- I try to keep my codes up to date there http://www.arsaniit.com, so feel free to tell me if it needs a fix or two.
- these dogs don't belongs to me. Thanks god (or sknahT dog)
You do not have the required permissions to view the files attached to this post.
User avatar
drspro2
VIP Member
Posts: 105
Joined: 28 Apr 2006 12:03

Post by drspro2 »

I believe that the following modification should be made to make it possible to read longer url-strings

Code: Select all

% new         getURLContentAsBin(URL) = Res :-           IT   = vp_web::internetOpenws(),           FIT = vp_web::internetOpenUrlWs(IT,URL),           binres := binary::createAtomic(0),           sz := 0,           programControl::repeat,               Temp = binary::createAtomic(bufferSize),               Remain = vp_web::internetReadFile(FIT, Temp, bufferSize),                     sz:=sz+Remain,                     Temp2 = binary::reSize(Temp,Remain),                     binres := binary::concat(binres, Temp2),          Remain = 0,          vp_web::internetClosehandle(FIT),          vp_web::internetClosehandle(IT),          Res = binary::reSize(binres,sz),     !.     /* Old       getURLContentAsBin(URL) = Res :-           IT   = vp_web::internetOpenws(),           FIT = vp_web::internetOpenUrlWs(IT,URL),           binres := binary::create(0),           sz := 0,           Temp = binary::create(bufferSize),           programControl::repeat,               Remain = vp_web::internetReadFile(FIT, Temp, bufferSize),               sz:=sz+Remain,               binres := binary::concat(binres, Temp),           Remain = 0,          vp_web::internetClosehandle(FIT),          vp_web::internetClosehandle(IT),          Res = binary::resize(binres,sz),     !.%    */
byronGaf
Posts: 4
Joined: 30 Apr 2019 20:59

Howto get an image from internet and display it and more

Post by byronGaf »

ListSubItemsIndex has a ReportIcon-Property, but all examples i found use an ImageList, so no idea if it works with an image from a path