DelphiFAQ Home Search:

DDE link to NetScape.

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Create a new application with a form Form1, put the components on it as in the following class defined (buttons, edit controls, labels and one TDDEClientConv) and link the events to the given procedures.

Button3 will have NetScape open the entered url.

unit Netscp1;

Interface

Uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, DdeMan;

type
  TForm1 = class (TForm)
    DdeClientConv1 : TDdeClientConv;
    Button1        : TButton;
    Button2        : TButton;
    Button3        : TButton;
    LinkStatus     : TEdit;
    Label1         : TLabel;
    Label2         : TLabel;
    URLName        : TEdit;
    procedure Button1Click (Sender: TObject);
    procedure FormCreate (Sender: TObject);
    procedure Button2Click (Sender: TObject);
    procedure Button3Click (Sender: TObject);
  private
  { private declarations }
    public
    { public declarations }

  end;

var
  Form1      : TForm1;
  LinkOpened : integer;

implementation

{$R *.DFM}
procedure TForm1.Button1Click (Sender: TObject);
begin
  if LinkOpened = 0 then
  begin
    DdeClientConv1.SetLink ('Netscape', 'WWW_OpenURL');
    if DdeClientConv1.OpenLink then
    begin
      LinkStatus.Text := 'Netscape Link has been opened';
      LinkOpened := 1
    end
    else
      LinkStatus.Text := 'Unable to make Netscape Link'
  end
end;


procedure TForm1.FormCreate (Sender: TObject);
begin
  LinkOpened := 0
end;


procedure TForm1.Button2Click (Sender: TObject);
begin
  DdeClientConv1.CloseLink;
  LinkOpened := 0;
  LinkStatus.Text := 'Netscape Link has been closed'
end;


procedure TForm1.Button3Click (Sender: TObject);
var
  ItemList : String;
begin 
  if LinkOpened <> 0 then 
  begin 
    ItemList := URLName.Text + ',,0xFFFFFFFF,0x3,,,'; 
    DdeClientConv1.RequestData (ItemList)
  end
end; 


end.
You don't like the formatting? Check out SourceCoder then!
Content-type: text/html

Comments:

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: