10 de jan. de 2011

como fazer um hot link ( delphi )

Adicione um componente com o URL. Digite o seguinte código no seu evento OnClick:
procedure Tform1.URLLabelClick(Sender: TObject);
var TempString : array[0..79] of char;
begin
   StrPCopy(TempString,URLLabel.Caption);
   OpenObject(TempString);
end;
Insira a seguinte procedure logo após implementation:
procedure TTOKAboutBox.OpenObject(sObjectPath : PChar);
begin
 ShellExecute(0, Nil, sObjectPath, Nil, Nil, SW_NORMAL);
end;
Adicione "ShellAPI" no uses.
 

Nenhum comentário:

Postar um comentário