WebBrowser控件打开的网页不可以复制、剪切
请问是不是DELPHI的BUG呀,大家怎么解决呀!
操作系统:2000 Server
Delphi版本:6.0
IE:6.0 + sp1
谢谢

解决方案 »

  1.   

    // uses ActiveX;
    // Put this Code at the end of your unit:initialization
      OleInitialize(nil);finalization
      OleUninitialize;
      

  2.   

    你的DELPHI是哪个版本的呀
    有没有打补丁之类的呀?
    我的是D6,没打补丁
      

  3.   

    参考下面的代码:var
      Form1: TForm1;
      FOleInPlaceActiveObject: IOleInPlaceActiveObject;
      SaveMessageHandler: TMessageEvent;...implementation...procedure TForm1.FormActivate(Sender: TObject);
    begin
      SaveMessageHandler := Application.OnMessage;
      Application.OnMessage := MyMessageHandler;
    end;procedure TForm1.FormDeactivate(Sender: TObject);
    begin
      Application.OnMessage := SaveMessageHandler;
    end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      Application.OnMessage := SaveMessageHandler;
      FOleInPlaceActiveObject := nil;
    end;procedure TForm1.MyMessageHandler(var Msg: TMsg; var Handled: Boolean);
    var
      iOIPAO: IOleInPlaceActiveObject;
      Dispatch: IDispatch;
    begin
      { exit if we don't get back a webbrowser object }
      if WebBrowser = nil then
      begin
        Handled := False;
        Exit;
      end;  Handled:=(IsDialogMessage(WebBrowser.Handle, Msg) = True);  if (Handled) and (not WebBrowser.Busy) then
      begin
        if FOleInPlaceActiveObject = nil then
        begin
          Dispatch := WebBrowser.Application;
          if Dispatch <> nil then
          begin
            Dispatch.QueryInterface(IOleInPlaceActiveObject, iOIPAO);
            if iOIPAO <> nil then
              FOleInPlaceActiveObject := iOIPAO;
          end;
        end;    if FOleInPlaceActiveObject <> nil then
          if ((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP)) and
             ((Msg.wParam = VK_BACK) or (Msg.wParam = VK_LEFT) or (Msg.wParam = VK_RIGHT)) then
            //nothing - do not pass on Backspace, Left or Right arrows
          else
            FOleInPlaceActiveObject.TranslateAccelerator(Msg);
      end;
    end;
    unit最后面要加上
     initialization
       OleInitialize(nil);
     
     finalization
       OleUninitialize;http://members.home.net/hfournier/网站上有很多关于TWebBrowser编程的知识。
      

  4.   

    谢谢,行了,开始没引用ActiveX单元,后来加上了但“cronuz(cronus)”朋友的代码里面有全角空格
    结果不行,呵呵谢谢大家啦。
    正确的代码如下:
    unit main;interfaceuses
      ActiveX;  //其它代码initialization
      OleInitialize(nil);
      
    finalization
      OleUninitialize;end.//单元的结束