zoukankan      html  css  js  c++  java
  • 通过TApplicationEvents响应消息

    1

    源代码:
    ------------------------------------------------------------------------

    unit Unit1;

    interface

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

    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        ApplicationEvents1: TApplicationEvents;
        procedure FormCreate(Sender: TObject);
        procedure ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Memo1.Clear;
    end;

    {响应 WM_MOUSEMOVE 以外的所有消息}
    procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
      var Handled: Boolean);
    begin
      if Msg.message <> WM_MOUSEMOVE then
        Memo1.Lines.Add('$' + IntToHex(Msg.message, 4));
    end;

    end.

    界面代码:
    ---------------------------------------------------------------------

    object Form1: TForm1
      Left = 0
      Top = 0
      Caption = 'TApplicationEvents'
      ClientHeight = 215
      ClientWidth = 325
      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 Memo1: TMemo
        Left = 4
        Top = 8
        Width = 313
        Height = 161
        Lines.Strings = (
          'Memo1')
        TabOrder = 0
      end
      object ApplicationEvents1: TApplicationEvents
        OnMessage = ApplicationEvents1Message
        Left = 40
        Top = 152
      end
    end

  • 相关阅读:
    SQL语句
    POJ2586——Y2K Accounting Bug
    POJ1328——Radar Installation
    POJ2965——The Pilots Brothers' refrigerator
    SDIBT2666——逆波兰表达式求值
    POJ1753——Flip Game
    Python全栈开发-有趣的小程序
    跑马灯效果、jquery封装、$.fn和$.extend方法使用
    js 实现浏览器全屏效果
    百度地图点聚合功能如何提高性能
  • 原文地址:https://www.cnblogs.com/hackpig/p/1668221.html
Copyright © 2011-2022 走看看