zoukankan      html  css  js  c++  java
  • 学习 Message(8): 使用不同的消息结构


    下面是同样的四段程序, 但分别使用了不同的三种消息结构: TWMMouseMove、TWMMouse、TMessage
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;
    
    type
      TForm1 = class(TForm)
      protected
        procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE;
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.WMMouseMove(var Message: TWMMouseMove);
    var
      x,y: Integer;
    begin
      x := Message.XPos;
      y := Message.YPos;
      Text := Format('%d, %d', [x,y]);
    end;
    
    end.
    
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;
    
    type
      TForm1 = class(TForm)
      protected
        procedure WMMouseMove(var Message: TWMMouse); message WM_MOUSEMOVE;
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.WMMouseMove(var Message: TWMMouse);
    var
      x,y: Integer;
    begin
      x := Message.XPos;
      y := Message.YPos;
      Text := Format('%d, %d', [x,y]);
    end;
    
    end.
    
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;
    
    type
      TForm1 = class(TForm)
      protected
        procedure WMMouseMove(var Message: TMessage); message WM_MOUSEMOVE;
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.WMMouseMove(var Message: TMessage);
    var
      x,y: Integer;
    begin
      x := Message.LParamLo;
      y := Message.LParamHi;
      Text := Format('%d, %d', [x,y]);
    end;
    
    end.
    
  • 相关阅读:
    YApi 部署记录
    《Go语言网络编程》第一章:体系
    Golang知识图谱
    Docker学习笔记之二:制作镜像并PUSH
    下载m3u8视频
    杂知识
    遗传算法
    评分卡
    小数据玩转Pyspark(2)
    从Word Embedding到Bert模型—自然语言处理中的预训练技术发展史(转载)
  • 原文地址:https://www.cnblogs.com/del/p/1321559.html
Copyright © 2011-2022 走看看