TSmoothImageListBox

Hi, could you make the following changes to the TSmoothImageListBox/GDIPicture control to support web support across all GDI Picture products...

//procedure TImageLoaderThread.Execute;
gpimage := TAdvGDIPPicture.Create;
if sameText(copy(location,1,7),'http://') or sameText(copy(location,1,8),'https://') then
gpimage.LoadFromURL(Location)
else
gpimage.LoadFromFile(Location);

//AdvGDIP

procedure TAdvGDIPPicture.Download( url: string ); {new}
var
RBSIZE:dword;
httpstatus,httpsize,err:integer;
dwIdx:dword;
dwBufSize:dword;
ms:TMemoryStream;
len:dword;
cbuf:array[0..255] of char;
rb:array[0..4095] of byte;
fISession:hinternet;
fIHttp:hinternet;
cancel:boolean;

begin
FISession := InternetOpen('WebImage',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
if (FISession = nil) then
begin
// DownLoadError('Cannot open internet session');
// FThreadBusy := False;
Exit;
end;

FIHttp := InternetOpenURL(fISession,pchar(url),nil,0,
INTERNET_FLAG_PRAGMA_NOCACHE or INTERNET_FLAG_NO_CACHE_WRITE or INTERNET_FLAG_RELOAD,0);

if (FIHttp = nil) then
begin
InternetCloseHandle(FISession);
// DownLoadError('Cannot open http connection');
// FThreadBusy := False;
Exit;
end;

dwBufSize := SizeOf(cbuf);
dwidx:=0;
HttpQueryInfo(fIHttp,HTTP_QUERY_STATUS_CODE,@cbuf,dwBufSize,dwIdx);

val(cbuf,httpstatus,err);
if (httpstatus <> 200) or (err <> 0) then
begin
InternetCloseHandle(fISession);
InternetCloseHandle(fIHttp);
// DownLoadError('Cannot open URL '+furl);
// FThreadBusy := False;
Exit;
end;

dwBufSize:=sizeof(cbuf);
dwidx:=0;
HttpQueryInfo(fIHttp,HTTP_QUERY_CONTENT_TYPE,@cbuf,dwBufSize,dwIdx);

if (pos('IMAGE',uppercase(strpas(cbuf)))=0) then
begin
InternetCloseHandle(fISession);
InternetCloseHandle(fIHttp);
// DownLoadError('Resource is not of image type : '+furl);
// FThreadBusy:=false;
Exit;
end;

dwBufSize := SizeOf(cbuf);
dwidx := 0;
HttpQueryInfo(fIHttp,HTTP_QUERY_CONTENT_LENGTH,@cbuf,dwBufSize,dwIdx);

Val(cbuf,httpsize,err);

if ((httpsize = 0) or (err <> 0)) {and CheckContentLength} then
begin
InternetCloseHandle(fISession);
InternetCloseHandle(fIHttp);
// DownLoadError('Image size is 0');
// FThreadBusy := False;
Exit;
end;

// DownLoadProgress(0,httpsize);

len := 4096;
RBSIZE := 4096;

ms := TMemoryStream.Create;

Cancel := False;

while (len > 0) and not Cancel do
begin
InternetReadFile(fIHttp,@rb,RBSIZE,len);
if len > 0 then
ms.WriteBuffer(rb,len);
// DownLoadProgress(ms.Size,httpsize);
// DownLoadCancel(cancel);
end;

if not cancel then
begin
ms.Position := 0;
LoadFromStream(ms);
// DownLoadComplete;
end;

ms.Free;

InternetCloseHandle(fIHttp);
InternetCloseHandle(fISession);
// FThreadBusy := false;
end;

procedure TAdvGDIPPicture.LoadFromURL(url: string); {existing, modified}
begin

if (pos('HTTP://',UpperCase(url))=1) or (pos('HTTPS://',UpperCase(url))=1) then
Download( url )
else if (pos('RES://',UpperCase(url))=1) then
begin
Delete(url,1,6);
if (url<>'') then
LoadFromResourceName(hinstance,url);
Exit;
end
else if (pos('FILE://',uppercase(url))=1) then
begin
Delete(url,1,7);
if (url<>'')
then LoadFromFile(url);
end;
end;