1
2 unit Unit1;
3
4 interface
5
6 uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, OleCtrls, SHDocVw, StdCtrls;
9
10 type
11 TForm1 = class(TForm)
12 btnGoTo: TButton;
13 WebBrowser1: TWebBrowser;
14 btnPrint: TButton;
15 procedure btnGoToClick(Sender: TObject);
16 procedure btnPrintClick(Sender: TObject);
17 private
18 { Private declarations }
19 public
20 { Public declarations }
21 end;
22
23 var
24 Form1: TForm1;
25
26 implementation
27
28 {$R *.dfm}
29
30 procedure TForm1.btnGoToClick(Sender: TObject);
31 //gose to website
32 var
33 Flags: OLEVariant;
34 begin
35 Flags:=0;
36 WebBrowser1.Navigate(WideString('http://www.borland.com'), Flags, Flags, Flags,
37 Flags);
38
39 end;
40
41 procedure TForm1.btnPrintClick(Sender: TObject);
42 //prints website
43 var
44 I, O: OleVariant;
45 begin
46 I := 0;
47 WebBrowser1.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, I, O);
48
49 end;
50
51 end.
|