自定义消息发送字符串

定义消息

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;

你可能感兴趣的:(delphi)