c語言是大小寫敏感,所有的字元串都要用text包起來,避免出錯
text是一個宏,當字元串中有中文的時候最好用text來包圍這個字元串,雖然不使用text在vc6中沒問題,但是在vc7中有問題,而且微軟也建議使用text宏,是以在涉及到中文的場合要使用它。他的作用就是把中文轉化成不會亂碼的格式。(暫時這麼認為)。_t("問好"),其實_t隻是text的一個縮寫而已。而且_t在有的低版本裡不識别。text()低版本也識别。暫時不用關心text的細節
【檔案】→【建立】,打開【工程】選項頁,選擇【win32 application】,下一步【一個簡單的windows程式】

int apientry winmain(hinstance hinstance,
hinstance hprevinstance,
lpstr lpcmdline,
int ncmdshow)
{
/* todo: place code here.*/
messagebox(null,text("世界您好"),text("标題"),mb_ok);
return 0;
}
可是如果我想顯示“确定、取消”按鈕的時候同時使用問号圖示呢?

messagebox(null, text("世界你好"), text("你好"), mb_okcancel|mb_iconquestion);
“ | ”是什麼意思?“ | ”是位運算裡的“或”運算,隻有對應的兩個二進位有一位為 1 時,結果位才為 1 ,否則為 0 。 mb_ok、mb_okcancel等的低四位不同,但是高位永遠為0; mb_iconhand 、 mb_iconquestion 等的低 5 至第 8 位不同,而其他位永遠為 0 。這樣“ mb_ok、mb_okcancel ”組的數值與“ mb_iconhand 、 mb_iconquestion ”組的數值進行或運算後能分别保留各自的部分,也就是在結果值中同時展現兩組的取值。
可設定希望在對話框中顯示的按鈕:

#define mb_ok 0x00000000l
#define mb_okcancel 0x00000001l
#define mb_abortretryignore 0x00000002l
#define mb_yesnocancel 0x00000003l
#define mb_yesno 0x00000004l
#define mb_retrycancel 0x00000005l
也可以設定對話框中顯示的圖示:

#define mb_iconhand 0x00000010l
#define mb_iconquestion 0x00000020l
#define mb_iconexclamation 0x00000030l
#define mb_iconasterisk 0x00000040l
選擇後的判定

int ret = messagebox(null, text("你是外星人嗎?"), text("火星人"),mb_yesno | mb_iconquestion);
if(idyes==ret){
messagebox(null, text("火星人你好"), text("問好"),mb_ok);
else{
messagebox(null, text("歡迎回家來"), text("問好"),mb_ok);
跟多參考win32api