HTML/INTERNET
Recently I have seen an interesting effect in some programs. You know, almost every program has an About box, and within that there is a plain WWW address like "http://www.somewhere.com". When I move the mouse over that address, it suddently turns blue and become a hotlink! When I click on it my browser is launched automatically and the site is connected. Would anyone tell me how to archive that effect in my own application?[Robert E. Baker, bobbaker@cris.com]
Create your label component with the URL (I call mine URLLabel) as it's caption. I also make the text a different color to make it stand out from any other labels on the form. Then, on the OnClick even for the label, enter the following code:
procedure TTOKAboutBox.URLLabelClick(Sender: TObject); var TempString : array[0..79] of char; begin StrPCopy(TempString,URLLabel.Caption); OpenObject(TempString); end;
procedure TTOKAboutBox.OpenObject(sObjectPath : PChar); begin ShellExecute(0, Nil, sObjectPath, Nil, Nil, SW_NORMAL); end;
As far as the cursor goes, I set the URLLabel.Cursor property to crAppStart.
Please email me and tell me if you liked this page.