自定义消息发送字符串

来源:互联网 发布:scratch for windows 编辑:程序博客网 时间:2024/05/16 10:32

定义消息

const
  WM_WMS_ACTIONBTN = WM_USER + 1;


发送消息

var
  aControlName: string;
begin
  aControlName := Self.Name;
  SendMessage(Parent.Handle, WM_WMS_ACTIONBTN, 0, Integer(PChar(aControlName)));
  inherited;
end;


接收消息

procedure WMS_MSG_WMSACTIONBTN(var message: TMessage); message WM_WMS_ACTIONBTN;


procedure TWMSPanel.WMS_MSG_WMSACTIONBTN(var message: TMessage);
var
  aStrName: string;
begin
  aStrName := PChar(message.LParam);
  showmessage(aStrName );
end;

0 0
原创粉丝点击