DelphiFAQ Home Search:

Create a 'hot URL link' in the About box

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Many programs have an About box with a WWW address in it. When the user clicks on that address, it will launch the webbrowser automatically and connect with the given site.

How to accomplish this?

Create your label component with the URL as it's caption.
Set the font's color to 'blue' and style 'underline' so that it looks like a link.

uses ShellAPI;
// ..
class
  TAboutBox = class(TForm)
    // ..
    URLLabel : TLabel;
  end;
// ..

 URLLabel.Cursor := crAppStart; { set this in the object inspector }
// ..

// onClick event handler
procedure TAboutBox.URLLabelClick(Sender: TObject);
var TempString : array[0..79] of char;
begin
  StrPCopy(TempString,URLLabel.Caption);
  ShellExecute(0, Nil, TempString, Nil, Nil, SW_NORMAL);
end;
You don't like the formatting? Check out SourceCoder then!

Comments:

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: