我想请教一下各位大虾,如何使MessageBox弹出的对话框永远是在窗体的最上层,无论当前窗体是否和Application有关,我用的是
MessageBox(GetActiveWindow, 'aa', 'aa', MB_OK or MB_ICONINFORMATION);
但是很多时候 MessageBox还是不在最上层只是在工具栏里面出来一个标题而已各位有什么办法能让自己应用程序的MessageBox永远是在窗体的最上层
MessageBox(GetActiveWindow, 'aa', 'aa', MB_OK or MB_ICONINFORMATION);
但是很多时候 MessageBox还是不在最上层只是在工具栏里面出来一个标题而已各位有什么办法能让自己应用程序的MessageBox永远是在窗体的最上层
就搞定
showmodal就是了
既然不能,就自己来吗,呵呵
弹出的messagebox自然在最上面了
不过要慎用,特别是调试的时候,一定要跳过他,不能调试,否则delphi死掉,因为他是必须响应的,delphi的窗口会呼不出来。
begin
inherited;
With Params do
begin
wndParent:=GetDesktopwindow;
ExStyle:=ExStyle or WS_EX_TOPMOST;
end;
end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Form2.show;
ShowWindow(Application.handle,sw_show);
end;form2为主窗体
procedure TForm2.Button1Click(Sender: TObject);
begin
with tform1.create(self) do show;
hide;
ShowWindow(Application.handle,sw_hide);
end;
ok...
任何时候都可以在最前面了
即可
with Application do
begin
NormalizeTopMosts;
MessageBox('This should be on top.', 'Look', [smbOK]);
RestoreTopMosts;
end;