Click to See Complete Forum and Search --> : help about delphi project


mahii
June 21st, 2009, 01:03 PM
i am making a simple project in delphi .. i have an image on a form i want to make a link to a webpage when clicked on image on runtime . i do not know the code for the same .

plz help me urgently with code

BytePtr
July 11th, 2009, 11:18 AM
First make sure that your image control is selected on form.
Now in design time choose Events tab in Object Inspector and choose first event: OnClick.
Double click on the white box there and now write such line in the event.
ShellExecute(Form1.Handle, 'open', 'http://www.google.com', '', '', SW_SHOWNORMAL );

So now it should look like this:
procedure TForm1.Image1Click(Sender: TObject);
begin
ShellExecute(Form1.Handle, 'open', 'http://www.google.com', '', '', SW_SHOWNORMAL );
end;


You must change Form1 to your own form name and Google url to your own url.
Do not change anything else if you don't know how it works.



Be sure to add ShellApi to your Unit's uses clause.



Any additional questions about Delphi?

ASK ME.