首页  编辑  

WebBrowser的Copy、Delete、Cut

Tags: /超级猛料/OS.操作系统/IE.扩展/TWebBrowser/操作/   Date Created:

下面的代码检测Copy命令是否可以使用:

procedure TForm1.ButtonIsCopyEnabledClick(Sender: TObject);

begin

 if Webbrowser1.OleObject.Document.queryCommandEnabled('Copy') then

   ShowMessage('Copy is active/ Copy ist aktiv');

end;

**********************************************

Copy, Delete, Cut in the TWebbrowser?

uses

ActiveX;

 

// Copy the selected text to the clipboard

// Den markierten Text in die Zwischenablage kopieren

procedure TForm1.Button7Click(Sender: TObject);

begin

 try

   WebBrowser1.ExecWB(OLECMDID_COPY, OLECMDEXECOPT_PROMPTUSER);

 except

 end;

end;

// Cut the selected text

// Den markierten Text ausschneiden

procedure TForm1.Button8Click(Sender: TObject);

begin

 try

   WebBrowser1.ExecWB(OLECMDID_CUT, OLECMDEXECOPT_PROMPTUSER);

 except

 end;

end;

// Delete the selected text

// Den markierten Text l 鰏chen

procedure TForm1.Button9Click(Sender: TObject);

begin

 try

   WebBrowser1.ExecWB(OLECMDID_DELETE, OLECMDEXECOPT_PROMPTUSER);

 except

 end;

end;

initialization

 OleInitialize(nil);

finalization

 OleUninitialize;

end.

// as of Internet Explorer 4