dota1改键精灵:如何在C++中用弹出式信息框显示变量的值?

来源:百度文库 编辑:中科新闻网 时间:2024/05/06 07:11:18
变量A中储存着双击鼠标的次数,但是MESSAGEBOX函数似乎只能输出字符串常量,该怎么输出INT 变量A的值?

先格式化为字符串即可:

int i = 1234;
char tmp[32];
sprintf(tmp, "i = %d", i);
MessageBox(this, tmp, title, MB_OK);

char temp[1024];
sprintf(temp,"显示数值%d",A);
MessageBox(hwnd,temp,title,MB_OK);

staic UINT A;
/////////////////

CString str;
str.Format("鼠标双击的次数为:%d",A);

AfxMessageBox(str);