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)
-
- Active Member
- Posts: 25
- Joined: 8 Jun 2004 23:01
(Howto) get an image from internet and display it (and more)
- Attachments
-
- vp_web.jpg (81.28 KiB) Viewed 33525 times
-
- test_vp_web.zip
- (89.54 KiB) Downloaded 2270 times
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),
!.%
*/
Howto get an image from internet and display it and more
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