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.
    
  • 相关阅读:
    aop日志记录
    RocketMQ 启动停止命令
    windows搭建RocketMQ服务
    zTree实战
    springboot 传List参数
    Spring Boot之 Controller 接收参数和返回数据总结(包括上传、下载文件)
    SpringBoot Controller接收参数的几种常用方
    clob大数据转换为多行数据
    oracle dba学习
    TreeNode(包含读出文件里的信息)
  • 原文地址:https://www.cnblogs.com/del/p/1321559.html
Copyright © 2011-2022 走看看