资源描述:
《windows程序设计(第五版)源代码a(chap11)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、chap11-About1/*------------------------------------------ABOUT1.C--AboutBoxDemoProgramNo.1(c)CharlesPetzold,1998------------------------------------------*/#include#include"resource.h"LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);BOOLCALLBACKAboutDlgPro
2、c(HWND,UINT,WPARAM,LPARAM);intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,PSTRszCmdLine,intiCmdShow){staticTCHARszAppName[]=TEXT("About1");MSGmsg;HWNDhwnd;WNDCLASSwndclass;wndclass.style=CS_HREDRAW
3、CS_VREDRAW;wndclass.lpfnWndProc=WndProc;wndclass.cbClsEx
4、tra=0;wndclass.cbWndExtra=0;wndclass.hInstance=hInstance;wndclass.hIcon=LoadIcon(hInstance,szAppName);wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);wndclass.lpszMenuName=szAppName;wndclass.lpszClassName=szAppN
5、ame;if(!RegisterClass(&wndclass)){MessageBox(NULL,TEXT("ThisprogramrequiresWindowsNT!"),szAppName,MB_ICONERROR);return0;}hwnd=CreateWindow(szAppName,TEXT("AboutBoxDemoProgram"),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hIn
6、stance,NULL);ShowWindow(hwnd,iCmdShow);UpdateWindow(hwnd);while(GetMessage(&msg,NULL,0,0)){TranslateMessage(&msg);DispatchMessage(&msg);}returnmsg.wParam;}LRESULTCALLBACKWndProc(HWNDhwnd,UINTmessage,WPARAMwParam,LPARAMlParam){staticHINSTANCEhInstance;switch(message)
7、{caseWM_CREATE:hInstance=((LPCREATESTRUCT)lParam)->hInstance;return0;caseWM_COMMAND:switch(LOWORD(wParam)){caseIDM_APP_ABOUT:DialogBox(hInstance,TEXT("AboutBox"),hwnd,AboutDlgProc);break;}return0;caseWM_DESTROY:PostQuitMessage(0);return0;}returnDefWindowProc(hwnd,me
8、ssage,wParam,lParam);}BOOLCALLBACKAboutDlgProc(HWNDhDlg,UINTmessage,WPARAMwParam,LPARAMlParam){switch(message){caseWM_INITDIALOG:returnTRUE;caseWM_COMMAND:switch(LOWORD(wParam)){caseIDOK:caseIDCANCEL:EndDialog(hDlg,0);returnTRUE;}break;}returnFALSE;}chap11-About1Í·Î
9、ļþ//{{NO_DEPENDENCIES}}//MicrosoftDeveloperStudiogeneratedincludefile.//UsedbyAbout1.rc//#defineIDM_APP_ABOUT40001//Nextdefaultvaluesforn