unit About;

interface

uses
  Windows, Messages, Classes, Graphics, Controls, Forms,
  StdCtrls, ComCtrls, ShellAPI, RichEdit, xBase;

type
  TAboutForm = class(TForm)
    RichEdit: TRichEdit;
    procedure FormCreate(Sender: TObject);
  private
    procedure LinkClick(var Msg: TMessage); message WM_NOTIFY;
  public
    { Public declarations }
  end;

  PENLINK = ^TENLINK;

implementation

{$R *.dfm}

procedure TAboutForm.LinkClick(var Msg: TMessage);
var
  chrg: TCharRange;
begin
  if PNMHDR(Msg.lParam)^.code = EN_LINK then
    if PENLINK(Msg.lParam)^.msg = WM_LBUTTONUP then begin
      chrg := PENLINK(Msg.lParam)^.chrg;
      ShellExecute(Handle, 'open', PChar(Copy(RichEdit.Text, chrg.cpMin + 1, chrg.cpMax - chrg.cpMin)), '', '', SW_SHOWNORMAL);
      Exit;
    end;
  inherited;
end;

procedure TAboutForm.FormCreate(Sender: TObject);
begin
  SendMessage(RichEdit.Handle, EM_SETEVENTMASK, 0,
    SendMessage(RichEdit.Handle, EM_GETEVENTMASK, 0, 0) or ENM_LINK);
  SendMessage(RichEdit.Handle, EM_AUTOURLDETECT, Integer(True), 0);

  RichEdit.Text := GetStringFromResource('ABOUTTEXT');
end;

end.
