资源描述:
《Windows程序设计(第五版)源代码A(chap01--05).doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、......word文档......可供学习.参考chap01/*--------------------------------------------------------------HelloMsg.c--Displays"Hello,Windows98!"inamessagebox(c)CharlesPetzold,1998--------------------------------------------------------------*/#includeintWINAPIWinMain(H
2、INSTANCEhInstance,HINSTANCEhPrevInstance,PSTRszCmdLine,intiCmdShow){MessageBox(NULL,TEXT("Hello,Windows98!"),TEXT("HelloMsg"),0);return0;}chap02/*-----------------------------------------------------SCRNSIZE.C--Displaysscreensizeinamessagebox(c)CharlesPetzold,1998-----
3、------------------------------------------------*/#include#include#includeintCDECLMessageBoxPrintf(TCHAR*szCaption,TCHAR*szFormat,...){TCHARszBuffer[1024];va_listpArgList;//Theva_startmacro(definedinSTDARG.H)isusuallyequivalentto://pArgList
4、=(char*)&szFormat+sizeof(szFormat);va_start(pArgList,szFormat);//Thelastargumenttowvsprintfpointstothearguments_vsntprintf(szBuffer,sizeof(szBuffer)/sizeof(TCHAR),szFormat,pArgList);//Theva_endmacrojustzeroesoutpArgListfornogoodreason......专业资料...范文...范例..分享下载......wor
5、d文档......可供学习.参考va_end(pArgList);returnMessageBox(NULL,szBuffer,szCaption,0);}intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,PSTRszCmdLine,intiCmdShow){intcxScreen,cyScreen;cxScreen=GetSystemMetrics(SM_CXSCREEN);cyScreen=GetSystemMetrics(SM_CYSCREEN);Messag
6、eBoxPrintf(TEXT("ScrnSize"),TEXT("Thescreenis%ipixelswideby%ipixelshigh."),cxScreen,cyScreen);return0;}chap03/*------------------------------------------------------------HELLOWIN.C--Displays"Hello,Windows98!"inclientarea(c)CharlesPetzold,1998--------------------------
7、----------------------------------*/#includeLRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,PSTRszCmdLine,intiCmdShow){staticTCHARszAppName[]=TEXT("HelloWin");HWNDhwnd;MSGmsg;WNDCLASSwndclass;wndclas
8、s.style=CS_HREDRAW
9、CS_VREDRAW;wndclass.lpfnWndProc=WndProc;wndclass.cbClsExtra=0;wndclass.cbWndExtra=0;wndclass.hInst