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

  • 相关阅读:
    获得Coclor的色值(小技巧)
    如何禁止IIS缓存静态文件(png,js,html等)(转)
    风投最关心的问题
    Repeater一行显示数据库中多行表记录
    c# int Int32 Int64 的区别
    动车实名制了
    学习,积累,10000小时定律
    映射路由器到内网ip和端口
    《轮环》故事大纲整理
    .Net读取xlsx文件Excel2007
  • 原文地址:https://www.cnblogs.com/hackpig/p/1668221.html
Copyright © 2011-2022 走看看