Solved

ActiveX Form

Posted on 2000-03-17
4
237 Views
Last Modified: 2010-04-04
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.LoadFormFile("http://myserver/somepic.jpg")

Thanks in advance,
Peerapol
0
Comment
Question by:Mr_Peerapol
  • 2
  • 2
4 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2627616
hi,
someone made this one day,it works very well:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons,ExtCtrls,wininet,jpeg;

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_PRECONFIG, nil, nil, INTERNET_FLAG_MAKE_PERSISTENT);
if (aHI = nil) then exit;
aHURL := InternetOpenURL(aHI, PChar(strURL), nil, 0,
INTERNET_FLAG_EXISTING_CONNECT or
INTERNET_FLAG_MAKE_PERSISTENT, 0);
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(Stream);
AImage.picture.Assign(Image);
Image.Free;
Stream.Free;
end;


procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Getjpeg(Image1,'http://www.experts-exchange.com/images/eelogosmall.jpg');
end;

end.


Regards Barry
0
 
LVL 25

Author Comment

by:Mr_Peerapol
ID: 2628522
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

0
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
ID: 2630114
sorry i do not have this TImgEdit ..
0
 
LVL 25

Author Comment

by:Mr_Peerapol
ID: 2630541
That's okay.

Thanks,
Peerapol
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now