使用Twebbrowser内嵌到程序中,在使用中发现,拖入一个图片到里面,图片会自动打开在WEBbrowser里
拖入一个其他浏览器打不开的文件,就会打开一个下载对话框现在想禁止这种拖拽,求方法谢谢,在线等

解决方案 »

  1.   

    做了一个小试验,还行
    unit Unit1;interfaceuses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.OleCtrls, SHDocVw;type
      TForm1 = class(TForm)
        WebBrowser1: TWebBrowser;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        procedure AppMsg(var Msg: TMsg; var Handled: Boolean);
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      WebBrowser1.Navigate('about:blank');
      Application.OnMessage := AppMsg;
    end;procedure TForm1.AppMsg(var Msg: TMsg; var Handled: Boolean);
    begin
      if Msg.hwnd = WebBrowser1.Handle then
        if (Msg.message = WM_USER + 768) or (Msg.message = WM_USER + 780) then
          Msg.message := 0;
    end;
    end.