当用showmessage()或messagebox()弹出消息框时,如何获得用户在对话框重点击的按钮是哪个?
请详细点介绍一下好吗,我是一个菜鸟。

解决方案 »

  1.   

    if MessageBox(Handle, '试验', '测试点击了什么按钮', MB_YESNO) = 6 then
      ShowMessage('点击了YES按钮')
    else
      ShowMessage('点击了NO按钮');
      

  2.   

    老大,showmessage好像只有一个按钮吧,message是API函数,和showmessage是差不多的,要想得到Yes,No,Cancel的对话框可以用
    MessageDlg('这里是你的内容',mtConfirmation,mbYesNoCancel,0),返回的事实上是一个整数,当然也可以用mrYes,mrNo,mrCancel来表示返回的结果
      

  3.   

    messagebox()地返回值可以判断
    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.
      

  4.   

    谢谢楼上的指点,我原来不知道messagebox的用法,让高手见笑了