zoukankan      html  css  js  c++  java
  • 让IE右键失效

    1 

    主要演示了TApplicationEvents.OnMessage 的第二个参数 Handled 如果是 True, 表示消息已经处理过了, 到此为止.

    代码如下:

    unit Unit1;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, AppEvnts, OleCtrls, SHDocVw;

    type
      TForm1 = class(TForm)
        WebBrowser1: TWebBrowser;
        ApplicationEvents1: TApplicationEvents;
        procedure FormCreate(Sender: TObject);
        procedure ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
      var Handled: Boolean);
    begin
      if IsChild(WebBrowser1.Handle,Msg.hwnd) and ((Msg.message=WM_RBUTTONDOWN) or (Msg.message=WM_RBUTTONDBLCLK)) then
      begin
        Handled:=true;
      end;

    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      WindowState:= wsMaximized;
      WebBrowser1.Align:=alTop;
      WebBrowser1.Navigate('http://www.baidu.com');
    end;

    end.

    -------------------------------------------------------------

    界面代码如下:

    object Form1: TForm1
      Left = 0
      Top = 0
      Caption = 'IE'#21491#38190#22833#25928
      ClientHeight = 247
      ClientWidth = 312
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object WebBrowser1: TWebBrowser
        Left = 4
        Top = 8
        Width = 300
        Height = 201
        TabOrder = 0
        ControlData = {
          4C000000021F0000C61400000000000000000000000000000000000000000000
          000000004C000000000000000000000001000000E0D057007335CF11AE690800
          2B2E126208000000000000004C0000000114020000000000C000000000000046
          8000000000000000000000000000000000000000000000000000000000000000
          00000000000000000100000000000000000000000000000000000000}
      end
      object ApplicationEvents1: TApplicationEvents
        OnMessage = ApplicationEvents1Message
        Left = 24
        Top = 216
      end
    end

  • 相关阅读:
    继续聊WPF
    窥探Swift之别具一格的Struct和Class
    窥探Swift之类的继承与类的访问权限
    iOS开发之地图与定位
    iOS开发之WebView
    iOS开发之版本控制(SVN)
    iOS开发之抽屉效果实现
    iOS开发之调用系统打电话发短信接口以及程序内发短信
    转:GitHub 万星推荐成长技术清单
    vmware漏洞之四:简评USE-AFTER-SILENCE: EXPLOITING A QUIETLY PATCHED UAF IN VMWARE
  • 原文地址:https://www.cnblogs.com/hackpig/p/1668591.html
Copyright © 2011-2022 走看看