永发信息网

VC++ AfxMessageBox 参数(简单问题) (在线等。。急 摆脱

答案:4  悬赏:80  手机版
解决时间 2021-02-27 11:29
  • 提问者网友:王者佥
  • 2021-02-26 10:44
VC++ AfxMessageBox 参数(简单问题) (在线等。。急 摆脱

请问:
我的IP 是一个字符串 如何用AfxMessageBox 显示出来呢?
char name[155] = "";
char *ip;
AfxMessageBox(ip);

——————————
提示错误
“AfxMessageBox”: 2 个重载中没有一个可以转换所有参数类型
麻烦 写下代码 非常感谢。。。
可以加分
只要代码 不要写说明 或者转载
最佳答案
  • 五星知识达人网友:大漠
  • 2021-02-26 12:06
//方法有两种,最简便的是
CString str;
GetDlgItem(IDC_EDIT1)->GetWindowText(str);
AfxMessageBox( str );
//另外是添加控件映射变量,
UpdateData( TRUE );
str.Format(_T("%d"), m_nVal); // DDX_Text(pDX, IDC_EDIT1, m_nVal);
AfxMessageBox( str );
全部回答
  • 1楼网友:动情书生
  • 2021-02-26 14:40
strcpy(ip,name);AfxMessageBox(ip);你没加第一句。
  • 2楼网友:街头电车
  • 2021-02-26 14:05
不行就这样吧 CString str; str.Format("%s", ip); AfxMessageBox(str);
  • 3楼网友:执傲
  • 2021-02-26 12:30
你好! 不行就这样吧 CString str; str.Format("%s", ip); AfxMessageBox(str); 如有疑问,请追问。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯