BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

HTTP-link in Labels

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
Stefan Sidholm
Guest





PostPosted: Mon Jul 28, 2003 9:02 am    Post subject: HTTP-link in Labels Reply with quote



Hi,

How do I create a Link to a website on a form.
I've seen links that looks like labels but havent found any components that
would do that.

Grateful for any tips.

/Stefan sidholm



Back to top
Jari Kettunen
Guest





PostPosted: Mon Jul 28, 2003 9:11 am    Post subject: Re: HTTP-link in Labels Reply with quote



Following is one way to do it.

procedure TForm1.Label1Click(Sender: TObject);
begin
WWW('www.myhomepage.com');
end;


function Regkey(Key: HKEY; Subkey: string; var Data: string): Longint;
var
H : HKEY;
tData: array[0..259] of Char;
dSize: Integer;
begin
Result := RegOpenKeyEx(Key, PChar(Subkey), 0, KEY_QUERY_VALUE, H);
if Result = ERROR_SUCCESS then
begin
dSize := Sizeof(tData);
RegQueryValue(H, nil, tData, dSize);
Data := StrPas(tData);
RegCloseKey(H);
end;
end;

procedure WWW(page:String);
var
P : Integer;
Key: string;
begin
if Regkey(HKEY_CLASSES_ROOT, '.htm', Key) = ERROR_SUCCESS then
begin
Key := Key + 'shellopencommand';
if Regkey(HKEY_CLASSES_ROOT, Key, Key) = ERROR_SUCCESS then
begin
P := Pos('"%1"', Key);
if P = 0 then
P := Pos('%1', Key);
if P <> 0 then
setlength(Key, P - 1);
Key := Key + ' ' + page;
if WinExec(PChar(Key), SW_SHOWNORMAL) < 32 then
showMessage('Cannot find browser');
end;
end;
end;

"Stefan Sidholm"
Quote:
Hi,

How do I create a Link to a website on a form.
I've seen links that looks like labels but havent found any components
that
would do that.

Grateful for any tips.

/Stefan sidholm






Back to top
Andrew Jameson
Guest





PostPosted: Mon Jul 28, 2003 9:39 am    Post subject: Re: HTTP-link in Labels Reply with quote



Hmm ... maybe this is simpler ...

Add ShellAPI to your uses ...

procedure TForm1.lbWebSiteClick(Sender : TObject);
const
rSoftSpotWebsite = 'www.softspotsoftware.com';
begin
ShellExecute(Application.Handle, 'Open', PChar(rSoftSpotWebsite), nil,
nil, SW_NORMAL);
end; {lbWebSiteClick}

Andrew

Quote:
How do I create a Link to a website on a form.




Back to top
Mike Shkolnik
Guest





PostPosted: Mon Jul 28, 2003 11:33 am    Post subject: Re: HTTP-link in Labels Reply with quote

You may use our freeware SMURLLabel component:
http://www.scalabium.com/urllbl.htm (info)
http://www.scalabium.com/download/smcmpnt.zip (archive with freeware
SMComponent library)

--
With best regards, Mike Shkolnik
EMail: [email]mshkolnik (AT) scalabium (DOT) com[/email]
http://www.scalabium.com

"Stefan Sidholm" <stefan.sidholm (AT) uc (DOT) se> сообщил/сообщила в новостях
следующее: news:3f24e645$1 (AT) newsgroups (DOT) borland.com...
Quote:
Hi,

How do I create a Link to a website on a form.
I've seen links that looks like labels but havent found any components
that
would do that.

Grateful for any tips.

/Stefan sidholm





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.