I am making a simple text editor in Delphi 2006. The project is almost done, but I am having trouble getting clickable links to open a defualt browser to a specified webpage. I know there has to be an easy way to do this, but I have not found answers elsewhere.
Here is the code:
unit thanks;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons;
type
TForm4 = class(TForm)
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
btnOk: TBitBtn;
VPLSite: TLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
procedure VPLSiteClick(Sender: TObject);
procedure btnOkClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses
ShellAPI;
{$R *.dfm}
procedure TForm4.VPLSiteClick(Sender: TObject);
var s : string;
begin
s := (Sender as TLabel).Caption;
ShellExecute(GetDesktopWindow(), 'open', PChar(s), nil, nil, SW_SHOWNORMAL);
end;
procedure TForm4.btnOkClick(Sender: TObject);
begin
Close;
end;
end.
where could I be going wrong? Thank you in advance.
Here is the code:
unit thanks;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons;
type
TForm4 = class(TForm)
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
btnOk: TBitBtn;
VPLSite: TLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
procedure VPLSiteClick(Sender: TObject);
procedure btnOkClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses
ShellAPI;
{$R *.dfm}
procedure TForm4.VPLSiteClick(Sender: TObject);
var s : string;
begin
s := (Sender as TLabel).Caption;
ShellExecute(GetDesktopWindow(), 'open', PChar(s), nil, nil, SW_SHOWNORMAL);
end;
procedure TForm4.btnOkClick(Sender: TObject);
begin
Close;
end;
end.
where could I be going wrong? Thank you in advance.