请问MessageBox的用法!!

luo1105 2003-08-17 10:12:44
我想请教一下怎么用Messagebox!最好能给个实际的例子
...全文
71 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
fowler11 2003-08-17
  • 打赏
  • 举报
回复
选中 MessageBox,按F1,看Delphi的详细帮助,一清二楚。
ExSystem 2003-08-17
  • 打赏
  • 举报
回复
function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK):Interger;
//Text  :显示的消息(换行显示:Chr(13))
//Caption:消息框标题
//Flags :提供的按钮与图标(默认只显示“确定”按钮)
ExSystem 2003-08-17
  • 打赏
  • 举报
回复
- Displays a specified message to the user.
- Delphi syntax:
function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK): Integer;
- Description
Use MessageBox to display a generic dialog box a message and one or more buttons. Caption is the caption of the dialog box and is optional.
MessageBox is an encapsulation of the Windows API MessageBox function. TApplication's encapsulation of MessageBox automatically supplies the missing window handle parameter needed for the Windows API function.
The value of the Text parameter is the message, which can be longer than 255 characters if necessary. Long messages are automatically wrapped in the message box.
The value of the Caption parameter is the caption that appears in the title bar of the dialog box. Captions can be longer than 255 characters, but don't wrap. A long caption results in a wide message box.
The Flags parameter specifies what buttons appear on the message box and the behavior (possible return values). The following table lists the possible values. These values can be combined to obtain the desired effect.
----------------------------------
Value Meaning

MB_ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry, and Ignore.
MB_OK The message box contains one push button: OK. This is the default.
MB_OKCANCEL The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL The message box contains two push buttons: Retry and Cancel.
MB_YESNO The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL The message box contains three push buttons: Yes, No, and Cancel.

MessageBox returns 0 if there isn抰 enough memory to create the message box. Otherwise it returns one of the following values:

Value Numeric value Meaning

IDOK 1 The user chose the OK button.
IDCANCEL 2 The user chose the Cancel button.
IDABORT 3 The user chose the Abort button.
IDRETRY 4 The user chose the Retry button.
IDIGNORE 5 The user chose the Ignore button.
IDYES 6 The user chose the Yes button.
IDNO 7 The user chose the No button.
colacoca 2003-08-17
  • 打赏
  • 举报
回复
在 delphi中输入 messagebox ,然后点击F1

就会出现帮助,上面说得很详细,而且很多的东西你都在帮助里能找到答案,不用来这儿了
大地精灵 2003-08-17
  • 打赏
  • 举报
回复
if Application.messagebox('真的删除吗?','提示',mb_YesNo = 6 then
删除你的东西;
cnssk 2003-08-17
  • 打赏
  • 举报
回复
messagebox(application.handle,'Are you sure?','ques',mb_okcancel+mb_iconquestion)
cnssk 2003-08-17
  • 打赏
  • 举报
回复
messagebox(application.handle,'Hello!','info',mb_OK+mb_iconinformation)
liangzisiyun 2003-08-17
  • 打赏
  • 举报
回复
MessageBox(Application.Handle,
'您确认要修改此条记录吗?',
'提示',
MB_OKCANCEL + MB_DEFBUTTON2 + MB_ICONINFORMATION );
stout 2003-08-17
  • 打赏
  • 举报
回复
function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK): Integer;
例子:
Begin

with Application do
begin
NormalizeTopMosts;
MessageBox('This should be on top.', 'Look', [smbOK]);
RestoreTopMosts;
end;
end;

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧