5,927
社区成员




procedure ShowMsgInfo(strInfo:PChar);stdcall;
begin
Application.MessageBox(strInfo,'提示',MB_OK+MB_ICONINFORMATION);
end;
procedure ShowMsgInfo(strInfo:PChar)stdcall;
begin
MessageBox(GetForegroundWindow,strInfo,'提示',MB_OK+MB_ICONINFORMATION);
end;
[/quote]
可以这么用。不过GetForegroundWindow有返回为NULL的时候,比如通过Application.Minimize;窗口最小化的时候返回句柄为空,MessageBox对话框就会出现在任务栏上。procedure ShowMsgInfo(strInfo:PChar)stdcall;
begin
MessageBox(GetForegroundWindow,strInfo,'提示',MB_OK+MB_ICONINFORMATION);
end;
//定义过程:提示用户信息
procedure ShowMsgInfo(strInfo:PChar);stdcall;
begin
Application.MessageBox(strInfo,'提示',MB_OK+MB_ICONINFORMATION);
end;
exports
ShowMsgInfo;
主程序代码:
procedure TForm1.btn1Click(Sender: TObject);
var
strVal:string;
begin
strVal:=edt1.Text;
ShowMsgInfo(PChar(strVal));
end;//按钮btn1的单击事件
刚才补充了 帖代码吧,至少能重现出这个问题才能解决。
帖代码吧,至少能重现出这个问题才能解决。