Gallery
Software
Music
Programming
Archive
Tuesday, Jun 25 Week 26

Use TLabel as link to a web-address

Create new label on the form, and doubleclick on it to create OnClick event.

uses
windows,shellApi,forms;

function launchUrl(url:ansiString;h:THandle=INVALID_HANDLE_VALUE):boolean;
begin
if h=INVALID_HANDLE_VALUE then h:=application.handle;
result:=shellExecuteA(h,'open',pAnsiChar(url),nil,nil,SW_NORMAL)>0;
end;

Example

procedure TForm1.Label1Click(Sender: TObject);
begin
launchUrl('http://www.mortenbs.com/delphi-programming/')
end;

Related pages of Use TLabel as a web link

Download file using Indy HTTP
Download HTML-source using Indy HTTP
Remove HTML from text
Programming
Delphi programming
Delphi examples