首页 > 代码库 > messagebox在最顶层写法

messagebox在最顶层写法



MessageBox(Application.Handle, ‘text‘, ‘caption‘, MB_TOPMOST + MB_ICONINFORMATION);)

或者

MessageBox(Self.Handle, ‘text‘, ‘caption‘, MB_TOPMOST + MB_ICONINFORMATION);)

或者

Application.MessageBox(‘text‘, ‘caption‘, MB_TOPMOST + MB_ICONINFORMATION);)

 unit 打开文件目录;

interfaceuses  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,ShellAPI, Vcl.StdCtrls;type  TForm2 = class(TForm)    btn1: TButton;    btn2: TButton;    btn3: TButton;    btn4: TButton;    btn5: TButton;    btn6: TButton;    btn7: TButton;    btn8: TButton;    btn9: TButton;    btn10: TButton;    btn11: TButton;    btn12: TButton;    procedure btn1Click(Sender: TObject);    procedure btn2Click(Sender: TObject);    procedure btn3Click(Sender: TObject);    procedure btn4Click(Sender: TObject);    procedure btn5Click(Sender: TObject);    procedure btn6Click(Sender: TObject);    procedure btn7Click(Sender: TObject);    procedure btn8Click(Sender: TObject);    procedure btn9Click(Sender: TObject);    procedure btn10Click(Sender: TObject);    procedure btn11Click(Sender: TObject);    procedure btn12Click(Sender: TObject);  private    { Private declarations }  public    { Public declarations }  end;var  Form2: TForm2;implementation{$R *.dfm}procedure TForm2.btn4Click(Sender: TObject);beginmessagebox(0,没有选择播放类型,错误,MB_ICONINFORMATION+MB_OkCancel );end;procedure TForm2.btn5Click(Sender: TObject);beginApplication.MessageBox(MessageBox,警告,MB_ICONWARNING+MB_YesNo);end;procedure TForm2.btn6Click(Sender: TObject);vara:string;beginMessageBox(Form2.Handle,MessageBox,提示,MB_ICONINFORMATION+MB_OkCancel);end;procedure TForm2.btn7Click(Sender: TObject);beginMessageBox(Form2.Handle,MessageBox,提示,MB_ICONINFORMATION+MB_OkCancel+MB_DEFBUTTON2+MB_APPLMODAL);end;end.

 

messagebox在最顶层写法