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

  • 相关阅读:
    poj 1700 Crossing River 过河问题。贪心
    Alice's Print Service
    POI 2000 ------Stripes
    Uva 1378
    hdu 3068 最长回文
    bnu Game 博弈。
    链栈的C语言实现
    链栈的C语言实现
    顺序栈C语言实现
    顺序栈C语言实现
  • 原文地址:https://www.cnblogs.com/hackpig/p/1668221.html
Copyright © 2011-2022 走看看