在对话框里建了一个 EDIT BOX 和一个 BUTTON在BUTTON 的 单击事件中加了如下代码 CString strText;   
GetDlgItemText(IDC_EDIT2,strText);
int time;         
time = atoi(strText);  
::MessageBox(NULL,NULL,NULL,time);运行程序以后,没有收到MESSAGEBOX的消息,为什么呢??

解决方案 »

  1.   

    照楼上的调试
    错误信息如下
    cannot convert parameter 2 from 'int' to 'const char *'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
      

  2.   

    好象要加
    UpdateData(TRUE);
      

  3.   

    建立了,我给文本加了一个变量,INT型的,只输入数字变量名是  m_time
      

  4.   

    我用MESSAGEBOX 输出strText的值是对的莫非 MESSAGEBOX 不能输出INT型的值??
      

  5.   

    你是想输出文本框里的东西  在Messagebox里吗?
      要是用这个看看
      UpdateData(TRUE);
      ::MessageBox(NULL,m_time,NULL,MB_OK);
      

  6.   

    估计你位置写错了。先TRUE一下,再打印出来吧
    ------ 以下是签名 ------
    SoftDN.com, 提供免费的项目管理平台:SVN仓库、需求管理、BUG跟踪、任务管理、在线论坛、网站空间、项目存储及完整的备份等。欢迎网友光临建立项目,开创自己的梦想。
    地址:http://www.softdn.com   http://www.softdn.cn
      

  7.   

    对,意思没错不过这句话编译有问题error C2664: 'MessageBoxA' : cannot convert parameter 2 from 'int' to 'const char *'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast是不是MESSAGEBOX不能显示 INT类型的变量??
      

  8.   

    恩,是的CString str ;
    str.Format("%d",m_time );
    ::MessageBox(NULL,str,NULL,MB_OK);
      

  9.   

    UpdateData(TRUE);
    MessageBox(m_time);
    试过了可以
      

  10.   

    playlm 你的 M_TIME 是什么类型的?是INT型么?最简单的例子int abc=11;
    ::messagebox(abc);这个都是不可以的。。
      

  11.   

    你用CString temp;
    temp.Format("%d",m_time);
    转换成 CString 在用MessageBox(temp);显示