以下是我的源程序,在我机器上运行是正常得不能再正常了!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, DB, ADODB, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
ADOQuery1: TADOQuery;
ADOConnection1: TADOConnection;
WebBrowser: TWebBrowser;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
S:String;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser.Navigate(S);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
WebBrowser.ExecWB(OLECMDID_PRINTPREVIEW,0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('Select webcontent From tb_webdata Where ID=
D');
ADOQuery1.Parameters.ParamByName('DD').Value:=Strtoint(Edit1.Text);
AdoQuery1.Open;
S:=ADOQuery1.FieldByName('webcontent').AsString;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
S:='http://www.sina.com.cn';
end;
end.