Delphi自定义了一个消息 范例

//自己定义了一个消息 范例
unit  Unit1;

interface

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

const
  my_messagedisp=Wm_user+ 201 ;

type
  TForm1 =  class (TForm)
    Memo1: TMemo;
    Button1: TButton;
    
procedure  Button1Click(Sender: TObject);
  
private
     { Private declarations }
     procedure   mymesspro2( var  mymess: TMessage);  message   my_messagedisp;
  
public
     { Public declarations }
   end ;

var
  Form1: TForm1;

implementation

{$R *.dfm}
procedure  TForm1.mymesspro2( var  mymess: TMessage);
begin
     memo1.Lines.Add( '无法读取相关参数' );
end ;

procedure  TForm1.Button1Click(Sender: TObject);
begin
  SendMessage(Form1.Handle,my_messagedisp, 0 , 0 );  //测试通过
end ;

end .

你可能感兴趣的:(Delphi)