• 让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

  • 相关阅读:
    混jdon坛子的一些思考
    Jforum论坛安装
    自己对组件化模块的一点思路.
    自己对组件化模块的一点思路.
    总结(1)
    总结(1)
    Jforum论坛安装
    Windows 下 用 php 【mail()】函数发送邮件 (本地环境)
    使用TCP/IP协议实现聊天程序
    在vista上安装delphi7的解决方案
  • 原文地址:https://www.cnblogs.com/hackpig/p/1668591.html
Copyright © 2020-2023  润新知