const
CSHOWHINTMSG = WM_USER + 1000;
type
TForm1 = class(TForm)
procedure FormShow(Sender: TObject);
private
procedure DoShowHintForm(var Msg: TMessage); message CSHOWHINTMSG;
public
procedure aaa;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DoShowHintForm(var Msg: TMessage);
begin
ShowMessage('aa');
end;
procedure TForm1.FormShow(Sender: TObject);
begin
PostMessage(Self.Handle, CSHOWHINTMSG, 0, 0);
end;
如上面的代码,定义一个处理CSHOWHINTMSG消息的函数,然后在FormShow中调用这个消息,注意使用PostMessage,让其进入消息循环。