MessageBox

来源:互联网 发布:ce数组 编辑:程序博客网 时间:2024/05/16 00:24

第一个Windows程序。

知识点:

TCHAR  宽字符类型

TEXT     转化成宽字符 #define __TEXT(quote) L##quote

sprintf类函数  那个_vsntprintf  指针参数还不是很懂

#include<windows.h>#include<tchar.h>#include<stdio.h>int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,               PSTR szCmdLine, int iCmdShow){//MessageBox(NULL,TEXT("Hello,Windows 98!"),TEXT("HelloMsg"),MB_YESNOCANCEL|MB_DEFBUTTON1|MB_ICONSTOP);int cxScreen , cyScreen;cxScreen = GetSystemMetrics(SM_CXSCREEN);cyScreen = GetSystemMetrics(SM_CYSCREEN);TCHAR szBuffer[1024];_stprintf(szBuffer,L"The screen is %i pixels wide by %i pexels high.",       cxScreen,cyScreen);MessageBox(NULL,szBuffer,TEXT("ScrnSize"),0); return 0;}

 

原创粉丝点击