简单问题!

bit_hj 2003-02-12 03:06:17
我的程序在FormCloseQuery时间中这样写的
if(MessageDlg("您确定要退出吗?",mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo,0)==mrYes)
frm_Main->Close();

但不知为什么按yes没反应,按no却可以退出,不知道为什么。
还有就是我怎样可以按no直接关闭对话框,不做任何处理,按yes关闭程序。
谢谢!
...全文
37 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
chpeng 2003-02-13
  • 打赏
  • 举报
回复
同意 hnwlk() 的
cupidvenus 2003-02-12
  • 打赏
  • 举报
回复
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
CanClose = false;
if(MessageDlg("您确定要退出吗?",mtConfirmation,TMsgDlgButtons() <<mbYes<<mbNo,0)==mrYes)
{
CanClose = true;
}
}
痞子酷 2003-02-12
  • 打赏
  • 举报
回复
5555555555555
if(MessageDlg("您确定要退出吗?",mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo,0)==mrYes)
ShowMessage("mrYes");
else
ShowMessage("mrNo");
没有问题亚:)
cscer 2003-02-12
  • 打赏
  • 举报
回复
if(MessageDlg("您确定要退出吗?",mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo,0)==mrNo)
{
CanClose = false;
}
hnwlk 2003-02-12
  • 打赏
  • 举报
回复
补充:TForm1对应该为你程序中的frm_Main
hnwlk 2003-02-12
  • 打赏
  • 举报
回复
应改为:
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
if(MessageDlg("您确定要退出吗?",mtConfirmation,TMsgDlgButtons() <<mbYes<<mbNo,0)==mrYes)
{
CanClose = true;
}
else
{
CanClose = false;
}
}

1,178

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 数据库及相关技术
社区管理员
  • 数据库及相关技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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