资源描述:
《简单的c+扫雷程序.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、主程序部分:#include"stdafx.h"#include"shaolei.h"#include"common.h"#include"Control.h"#defineMAX_LOADSTRING100CControlg_control;boolg_bLive=true;//全?局?变?量?:HINSTANCEhInst;//当獭?前°实害?例TCHARszTitle[MAX_LOADSTRING];//标括?题琣栏?文?本?TCHARszWindowClass[MAX_LOADSTRING];//主÷窗洹?口ú类え?名?//此?代洙?码?模£块é中D包
2、悒?含?的?函ˉ数簓的?前°向ò声Θ?明÷:ATOMMyRegisterClass(HINSTANCEhInstance);BOOLInitInstance(HINSTANCE,int);LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);INT_PTRCALLBACKAbout(HWND,UINT,WPARAM,LPARAM);intAPIENTRY_tWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,LPTSTRlpCmdLine,intnCmdShow){UNRE
3、FERENCED_PARAMETER(hPrevInstance);UNREFERENCED_PARAMETER(lpCmdLine);//TODO:在ú此?放?置?代洙?码?。£MSGmsg;HACCELhAccelTable;//初?始?化ˉ全?局?字?符?串?LoadString(hInstance,IDS_APP_TITLE,szTitle,MAX_LOADSTRING);LoadString(hInstance,IDC_SHAOLEI,szWindowClass,MAX_LOADSTRING);MyRegisterClass(hInstance);//
4、执′行D应畖用?程ì序ò初?始?化ˉ:if(!InitInstance(hInstance,nCmdShow)){returnFALSE;}hAccelTable=LoadAccelerators(hInstance,MAKEINTRESOURCE(IDC_SHAOLEI));//主÷消?息¢循-环·:while(GetMessage(&msg,NULL,0,0)){if(!TranslateAccelerator(msg.hwnd,hAccelTable,&msg)){TranslateMessage(&msg);DispatchMessage(&msg);}
5、}return(int)msg.wParam;}////函ˉ数簓:MyRegisterClass()////目?的?:注痢?册á窗洹?口ú类え?。£////注痢?释酣?////仅?当獭?希£望?//此?代洙?码?与?添?加ó到?Windows95中D的?“°RegisterClassEx”±//函ˉ数簓之?前°的?Win32系μ统?兼?容╕时骸?,?才?需è要癮此?函ˉ数簓及°其?用?法ぁ?。£调獭?用?此?函ˉ数簓十?分?重?要癮,?//这a样ù应畖用?程ì序ò就í可é以?获?得?关?联的?//“°格?式?正y确ā?的?”±小?图?标括?。£//ATOMM
6、yRegisterClass(HINSTANCEhInstance){WNDCLASSEXwcex;wcex.cbSize=sizeof(WNDCLASSEX);wcex.style=CS_HREDRAW
7、CS_VREDRAW;wcex.lpfnWndProc=WndProc;wcex.cbClsExtra=0;wcex.cbWndExtra=0;wcex.hInstance=hInstance;wcex.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_SHAOLEI));wcex.hCursor=LoadCursor(
8、NULL,IDC_ARROW);wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);wcex.lpszMenuName=MAKEINTRESOURCE(IDC_SHAOLEI);wcex.lpszClassName=szWindowClass;wcex.hIconSm=LoadIcon(wcex.hInstance,MAKEINTRESOURCE(IDI_SMALL));returnRegisterClassEx(&wcex);}////函ˉ数簓:InitInstance(HINSTANCE,int)////目?的?:保馈?存
9、?实害?例句?柄括?并