MessageBox的使用

来源:互联网 发布:c语言putchar 编辑:程序博客网 时间:2024/05/19 19:33

#include <iostream>

#include <Windows.h>

#include <tchar.h>

using namespace std;

 

int main()

{

MessageBox(NULL, TEXT("你好HelloWorld!"),TEXT("Information"), 0 );

MessageBox(NULL, _T("你好HelloWorld!"),_T("Information"), 0 );

 

return 0;

}

用两个宏TEXT或者_T 都可以解决这个问题,它们两个并没有太大区别,也许区别在

于前者是通过windows.h头文件引入的,而_T 是通过 tchar.h引入的,我推荐大家使用_T

和tchar.h,因为tchar.h还帮助我们引入了其它一些很有用的宏,比如_tcscpy_s,这个宏

在使用UNICODE字符集的时候被替换成 wcscpy_s,在使用多字节字符集的使用被替换成

strcpy_s。


 有时候也可以这样用:

MessageBox(_T("使用说明向导已阅读完"), _T("提示"));

0 0
原创粉丝点击