Solved

connecting to a web-site

Posted on 1997-11-20
4
128 Views
Last Modified: 2010-04-04
I would like to make the URL in my about box clickable (hot-link) so it will open in a browser. I am running D1 and would like to implement this with a minimum investment in new tools. Any pointers would be much appreciated.

Thanks, Tom.
0
Comment
Question by:tomcorcoran
  • 2
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1351114
Also a lot of good FREEWARE components on the market.

Use these, they are already made. If not try this one. Or just use the pieces of code you need.

unit LinkLabel;

{*******************************************************}
{                                                       }
{       Delphi Visual Component Library                 }
{                                                       }
{       Copyright € 1996-97 Vitaly Zayko                }
{                                                       }
{                   TLinkLabel                          }
{                                                       }
{*******************************************************}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, StdCtrls, ShellAPI,
  Forms;

const
     URLCursor = 1;

type
  TLinkLabel = class(TCustomLabel)
  private
    FLinkColor:TColor;
    FLinkTo:String;
    procedure SetLinkColor(Value:TColor);
  protected
    procedure WMClick(var Msg:TMessage); message WM_LBUTTONDOWN;
  public
    constructor Create(AOwner:TComponent);override;
    destructor Destroy;override;
  published
    property Caption;
    property Font;
    property Color;
    property Visible;
    property ShowHint;
    property AutoSize;
    property WordWrap;
    property Align;
    property Alignment;
    property Enabled;
    property Transparent;
    property LinkColor:TColor read FLinkColor write SetLinkColor
      default clBlue;
    property LinkTo: String read FLinkTo write FLinkTo;
  end;

procedure Register;

implementation

constructor TLinkLabel.Create(AOwner:TComponent);
var
   WinSys:Array [0..255] of Char;
begin
     inherited Create(AOwner);
     Font.Style:=[fsUnderline];
     Font.Color:=clBlue;
     FLinkColor:=clBlue;
     GetSystemDirectory(WinSys,sizeof(WinSys));
     Screen.Cursors[URLCursor]:=LoadCursor(LoadLibrary(StrCopy(WinSys,
       PChar('hlp95en.dll'))),MakeIntResource(100));
     Cursor:=URLCursor;
end;

destructor TLinkLabel.Destroy;
begin
     Font.Style:=[];
     inherited Destroy;
end;

procedure TLinkLabel.SetLinkColor(Value:TColor);
begin
     FLinkColor:=Value;
     Font.Color:=Value;
     Refresh;
end;

procedure TLinkLabel.WMClick(var Msg:TMessage);
begin
     ShellExecute(GetDesktopWindow,'open',PChar(FLinkTo),nil,nil,
       SW_SHOWNORMAL);
end;

procedure Register;
begin
  RegisterComponents('Additional', [TLinkLabel]);
end;

end.

Have fun,
c.u. ZifNab;
0
 

Author Comment

by:tomcorcoran
ID: 1351115
Zifnab,

I'll have to look through the code to see how it works. I'll take your word for it. Thanks a lot, Tom.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1351116
Hello?
Problem solved?
If not this component should help you:
http://torry.rimini.com/vcl/internet/murl.zip
Have fun,
c.u. ZifNab;
0
 

Author Comment

by:tomcorcoran
ID: 1351117
I tried this one also. First dcu version error, the the windows dcu error, then resource file format error .dcr. I e-mailed the author to se if he had a D1 version or do you know? Thanks, Tom.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now