Mr_Peerapol
asked on
ActiveX Form
Hi all experts,
I am writing an server application that runs on web server. If a client runs this application by using web browser, I would like to know the way to load picture(at server side) to some picture components.
Here is my code:
Picture1.Picture.LoadFormF ile("http://myserver/somepic.jpg")
Thanks in advance,
Peerapol
I am writing an server application that runs on web server. If a client runs this application by using web browser, I would like to know the way to load picture(at server side) to some picture components.
Here is my code:
Picture1.Picture.LoadFormF
Thanks in advance,
Peerapol
ASKER
Barry,
If i use TImage, it woks well like you told me. But now I am using TImgEdit, do you know a way to load image?
Anyway, if you don't know it. I still accept your above answer later because I didn't specify the image component, I am using, in my question.
Thank you anyway,
Peerapol
If i use TImage, it woks well like you told me. But now I am using TImgEdit, do you know a way to load image?
Anyway, if you don't know it. I still accept your above answer later because I didn't specify the image component, I am using, in my question.
Thank you anyway,
Peerapol
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's okay.
Thanks,
Peerapol
Thanks,
Peerapol
someone made this one day,it works very well:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons,ExtCtrls,wininet,j
type
TForm1 = class(TForm)
SpeedButton1: TSpeedButton;
Image1: TImage;
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function GetNet( strURL: String ): String;
const
bufSiz = 512;
var
aHI, aHURL: HINTERNET;
buf: string;
s: string;
bytesRead: cardinal; {for d3 use integer}
aBool: boolean;
begin
Screen.cursor := crHourglass;
try
ahI := InternetOpen('CGITEST', INTERNET_OPEN_TYPE_PRECONF
if (aHI = nil) then exit;
aHURL := InternetOpenURL(aHI, PChar(strURL), nil, 0,
INTERNET_FLAG_EXISTING_CON
INTERNET_FLAG_MAKE_PERSIST
if (aHURL = nil) then exit;
s := '';
repeat
buf := '';
SetLength(buf, bufSiz);
aBool := InternetReadFile(aHURL, PChar(buf), bufSiz, bytesRead);
SetLength(buf, bytesRead);
if (aBool and (bytesRead <> 0)) then
s := s + buf;
until (aBool and (bytesRead = 0)) or (not aBool);
Result := s;
InternetCloseHandle(aHURL)
InternetCloseHandle(aHI);
finally
Screen.cursor := crDefault;
end;
end;
procedure GetJpeg( AImage: TImage; Url: String );
var
Stream: TStringStream;
Image: TJPEGImage;
s: string;
i: Integer;
begin
s := GetNet( Url );
Stream := TStringStream.Create(s);
Image := TJPEGImage.create;
Image.LoadFromStream(Strea
AImage.picture.Assign(Imag
Image.Free;
Stream.Free;
end;
procedure TForm1.SpeedButton1Click(S
begin
Getjpeg(Image1,'https://www.experts-exchange.com/images/eelogosmall.jpg');
end;
end.
Regards Barry