Author: Tomas Rutkauskas
How to form a DDE link with a Netscape browser
Answer:
1 unit Netscp1;
2
3 interface
4
5 uses
6 SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, DdeMan;
8
9 type
10 TForm1 = class(TForm)
11 DdeClientConv1: TDdeClientConv;
12 Button1: TButton;
13 Button2: TButton;
14 Button3: TButton;
15 LinkStatus: TEdit;
16 Label1: TLabel;
17 Label2: TLabel;
18 URLName: TEdit;
19 procedure Button1Click(Sender: TObject);
20 procedure FormCreate(Sender: TObject);
21 procedure Button2Click(Sender: TObject);
22 procedure Button3Click(Sender: TObject);
23 private
24 { Private declarations }
25 public
26 { Public declarations }
27 end;
28
29 var
30 Form1: TForm1;
31 LinkOpened: Integer;
32
33 implementation
34
35 {$R *.DFM}
36
37 procedure TForm1.Button1Click(Sender: TObject);
38 begin
39 if LinkOpened = 0 then
40 begin
41 DdeClientConv1.SetLink(' Netscape ', ' WWW_OpenURL ');
42 if DdeClientConv1.OpenLink then
43 begin
44 LinkStatus.Text := ' Netscape Link has been opened ';
45 LinkOpened := 1;
46 end
47 else
48 LinkStatus.Text := ' Unable to make Netscape Link ';
49 end;
50 end;
51
52 procedure TForm1.FormCreate(Sender: TObject);
53 begin
54 LinkOpened := 0;
55 end;
56
57 procedure TForm1.Button2Click(Sender: TObject);
58 begin
59 DdeClientConv1.CloseLink;
60 LinkOpened := 0;
61 LinkStatus.Text := ' Netscape Link has been closed ';
62 end;
63
64 procedure TForm1.Button3Click(Sender: TObject);
65 var
66 ItemList: string;
67 begin
68 if LinkOpened <> 0 then
69 begin
70 ItemList := URLName.Text + ', , 0xFFFFFFFF, 0x3, , ,';
71 DdeClientConv1.RequestData(ItemList);
72 end;
73 end;
74
75 end.
|