企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
`` 先上图: 一图胜千言: 带“双侧法线”的运行过程: ![](https://box.kancloud.cn/b613d2a958661ebedf34d52a2aac2ea3_523x501.png) ![](https://box.kancloud.cn/da4b7cb8876a17f94c6441fb47602cc7_524x542.png) 下图:带单侧法线的运行过程: ![](https://box.kancloud.cn/9b9e878300ce91692ad494989636ca6f_584x514.png) 下图:不带法线的运行结果: ![](https://box.kancloud.cn/c7e13d3ef6d290688e18aaac07d2769d_527x490.png) 改变颜色的目的,主要是为下一步做“频数”统计做准备; 即准备下一步的工作:即下一步需要统计每个点的光照频数。 **主要思路和部分代码**: (全部代码已经超出kancloud的允许长度) 期间还试用了一些其它语言完成,当然效率比c++还是差一些; 下次有机会(有时间)还可以优化,提高效率。改进方向包括: 1、异步产生数据,最后统一绘图显示; 2、用空间换时间; 3、不再迭代…… 迭代和递归的优点当然是程序代码清晰易懂、架构清晰、容易拓展、易调试、易修改;方便以后我们迁移、转换到其它图形比如:椭圆、比如 stadium(体育场等)型的图形当中去…… 用简洁、可迭代、并且可替换的形状和图形去随意替换软件中已有的图形……当然就有巨大优势咯! (如果)不用迭代(的方式)架构软件(程序),用存储空间(数组或链表等)存储、绘制数据……效率当然会更高、运行速度会更好些…… whatever... 这些C++(的代码)在我的 macbookpro2011(I7cpu,8G内存)上面跑已经速度足够(快)了。 ``` 再上核心代码,代码注释应该比较详细了: ``` #include "stdafx.h" #include <iostream> #include "Win32Project1light18digui181008d.h" #include <iomanip> using namespace std; //pi= 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679 #define PI18 3141592653589793238 #define PId 3.141592653589793238 #define MAX_LOADSTRING 100 // 全局变量: long double PIld = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679; //long long IterativeAllTimes = 0; int C1s_rightTimes = 0; int C2s_leftTimes = 0; unsigned __int64 halfPI_uint64_2 = 15707963267948966192;//157079632679489661923; (31415926535897932384) / 2; unsigned __int64 hPi = 15707963267948966192;// halfPI=90度 int C1_200_R01 = 200;//左圆半径(又称1号圆半径) int C2_200_R02 = 200;//右圆半径又称2号圆 int c1Xpianyi_X1 = 0; //左圆用初始值-(圆心的偏移量横坐标X为0 int c1Ypianyi_Y1 = 200;//左圆圆心位置-纵坐标 int c2Xpianyi_X2 = 300;//右圆圆心位置-横坐标 int c2Ypianyi_Y2 = 200;//右圆圆心位置-纵坐标 int c1C2_Distance = 300;//两圆圆心间距 //HDC hdc; HINSTANCE hInst; // 当前实例 TCHAR szTitle[MAX_LOADSTRING]; // 标题栏文本 TCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名 // 此代码模块中包含的函数的前向声明: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // TODO: 在此放置代码。 //调用Console控制台 AllocConsole(); #pragma warning(disable:4996) _tfreopen(TEXT("CONOUT$"), TEXT("w"), stdout); _tfreopen(TEXT("CONOUT$"), TEXT("w"), stderr); _tfreopen(TEXT("CONIN$"), TEXT("r"), stdin); #pragma warning(default:4996) _tsetlocale(LC_ALL, TEXT("chs")); cout << "PIld:"<<PIld << endl; MSG msg; HACCEL hAccelTable; // 初始化全局字符串 LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_WIN32PROJECT1LIGHT18DIGUI181008D, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // 执行应用程序初始化: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WIN32PROJECT1LIGHT18DIGUI181008D)); // 主消息循环: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam; } // // 函数: MyRegisterClass() // // 目的: 注册窗口类。 // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WIN32PROJECT1LIGHT18DIGUI181008D)); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = MAKEINTRESOURCE(IDC_WIN32PROJECT1LIGHT18DIGUI181008D); wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); return RegisterClassEx(&wcex); } // // 函数: InitInstance(HINSTANCE, int) // // 目的: 保存实例句柄并创建主窗口 // // 注释: // // 在此函数中,我们在全局变量中保存实例句柄并 // 创建和显示主程序窗口。 // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // 将实例句柄存储在全局变量中 hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; } // //下面自行定义“色域空间”当然目的是使得图像显示更清晰更干净 COLORREF getColor1RGB1(int i) { // if (-1 == i) return RGB(9, 9, 9); //黑灰 if (0 == i) return RGB(0, 0, 200); //蓝 if (1 == i) return RGB(0, 180, 0); //绿(暗绿) if (2 == i) return RGB(210, 0, 0); //红 if (3 == i) return RGB(200, 0, 200); //品紫 if (4 == i) return RGB(0, 255, 0); //亮绿 if (5 == i) return RGB(0, 255, 255); //亮青 if (6 == i) return RGB(255, 255, 0); //黄 if (7 == i) return RGB(9, 9, 9);//黑灰 // if(i>=7) return (200, 100, 100);//灰白 } // ``` 链接: https://pan.baidu.com/s/1Ilu2w91NGPdHOIn2_dQ57w 提取码: hxg3 ,操作更方便哦! ``` //光线射入两直线的粒子测试: //Recursive iteration //发光参数:// 参数 :0: hdc,1:which Circle 2:tt光线总长,3:入射弧度,4入射角度(废弃...角度非弧度), 5(当前)光线入口x坐标x01;6当前光线入口Y坐标Y01; int digui01DrawLine01light(HDC hdc , int whichCircle, long long tt, double incidenceAngle01Rad01, int rsjiaodu, int x01, int y01) //int digui01DrawLine01light( long long tt, int rsjiaodu, int x01, int y01) {//int digui01andDrawlight112110 IterativeAllTimes++; //这个在两直线间震荡的 部分不重要……程序太长了,需要的朋友再向我索取网盘地址: ``` ``` // //Recursive iteration //发光参数:// 参数 :0: hdc,1:which Circle 2:tt光线总长,3:入射弧度,4入射角度(废弃...角度非弧度), 5(当前)光线入口x坐标x01;6当前光线入口Y坐标Y01; int recursion01Draw02Circle02light03(HDC hdc, int whichCircle, long long tt, double incidenceAngle01Rad01, int x01, int y01) //int recursion01Draw02Circle02light03(HDC hdc, int whichCircle, long long tt, double incidenceAngle01Rad01, int rsjiaodu, int x01, int y01) {//int digui01andDrawlight112110 IterativeAllTimes++; printf_s("\r\IterativeAllTimes:%ld", IterativeAllTimes); // cout << "IterativeAllTimes:" << IterativeAllTimes << endl; // printf_s("run112110Here!"); // cout << "run112110Here!" << endl; if (tt <= 1) { cout << "[tt=1?" << tt << "]" << endl; return 1; } cout << "入射01弧度:" << incidenceAngle01Rad01;// << endl; cout << "{入射01角度度:" << incidenceAngle01Rad01*180/PId<<"}"<<endl; // rsHudu01 = (double)rsjiaodu*3.1415926 / 180.0; printf_s("_incidenceAngle01Rad01:=%f", incidenceAngle01Rad01); cout << endl; // cout << "rsHudu01:=" << rsHudu01 << endl; long lightDuanlen01 = 0;//当前光线 线段长度 // for (long long ii = 0; ii < tt; ++ii) {//for1110 ++lightDuanlen01; double singVectorX01 = cos(incidenceAngle01Rad01); double singVectorY01 = sin(incidenceAngle01Rad01); double originX001 = (double)lightDuanlen01*singVectorX01; double originY001 = (double)lightDuanlen01*singVectorY01; // int RealX0001 = (double)originX001 + x01; int RealY0001 = (double)originY001 + y01; //根据真实 实际坐标,描点成线--… // SetPixel(hdc, RealX0001, RealY0001, RGB(0, 0, 200)); //亮蓝 //判断: // int C1s_rightTimes = 0; // int C2s_leftTimes = 0; //判断真实点的轴距 //判断 是否 撞过 C1 圆1: //真实轴距离 long long realDistanceAxesBetweenXY00001andC1 = RealX0001 * RealX0001 + (RealY0001-200) * (RealY0001-200); //RealX0001>=200 一定跑出了 圆1,所以是废话(多重保险…… //2号圆的左侧弧: long long realDistanceAxesBetweenXY00001andC2 = (300 - RealX0001) * (300 - RealX0001) + (RealY0001 - 200) * (RealY0001 - 200); if ((/*3*/realDistanceAxesBetweenXY00001andC1 >= 200 * 200 /*3*/) && (/*3*/realDistanceAxesBetweenXY00001andC2 >= (200 * 200) /*3*/)) { return 0; } ////注意这里是撞 左侧大圆(1号圆)的右侧弧! if /*1*/ ( (/*2*/ 1==whichCircle/*2*/) && (/*2*/ (/*3*/realDistanceAxesBetweenXY00001andC1>= 200*200 /*3*/) || ( RealX0001 >= 200 ) /*2*/) )/*1*/ //if (/*1*/ 1 == whichCircle && RealX0001 >= 200 /*1*/) {//if11a10 ++C1s_rightTimes; cout << "C1s_rightTimes:" << C1s_rightTimes << endl; long long tt1new01 = tt - ii; //算法线: double faXian1Hudu01 = PId;// -0.1; //法线弧度初始设置为PI=π3.1415926... // faXian1Hudu01 = atan((double)RealY0001-200) / (RealX0001 ); // faXian1Hudu01 = PId + asin((double)(200.0-RealY0001 ) / (200)); //OK1 faXian1Hudu01 = atan(((double) RealY0001-200) / (RealX0001) ); //测试这个圆心的比率就是 (法线的)角度 if (faXian1Hudu01 < (-1 * PId)) { faXian1Hudu01 += PId; } cout << "[撞圆1的法线角(弧度:" << faXian1Hudu01 << "]"; // //画辅助线-法线 int x01x1 = RealX0001; int y01y1 = RealY0001; int x02x2 = -200 * cos((double)faXian1Hudu01)+RealX0001; int y02y2 = (200 * sin( -1*(double)faXian1Hudu01)+RealY0001); MoveToEx(hdc, RealX0001, RealY0001, NULL); HPEN hPen; hPen = CreatePen(PS_SOLID, 1, RGB(0,255, 0)); // 创建一个亮绿色的法线 SelectObject(hdc, hPen); // LineTo(hdc, x02x2, y02y2); //画(左圆)法线 double rusheHudu_faxianhudu = incidenceAngle01Rad01 - faXian1Hudu01; rusheHudu_faxianhudu = faXian1Hudu01-incidenceAngle01Rad01; cout << "[rusheHudu_faxianhudu:" << rusheHudu_faxianhudu << "]" << endl; double rsNewHudu01 = faXian1Hudu01;// +little_cita; //faXian1Hudu01; rsNewHudu01 = PId+ rusheHudu_faxianhudu + faXian1Hudu01; // if ((-1.0*PId / 2) < rsNewHudu01 && rsNewHudu01<0 ) rsNewHudu01 = PId - rsNewHudu01; // if ((PId ) < rsNewHudu01 && rsNewHudu01 < PId*2) rsNewHudu01 = rsNewHudu01-PId; //PId - faXian1Hudu01; //PId-faXian1Hudu01;//这是 正确方向的法线 向量; //BigA2 - rsHuDu_BuJiao + 3.0/2*PId; //(PId+faXian1Hudu01)-3.0/4*Pid; // littleCeta; //3.0/4*PId+2*faXian1Hudu01 - incidenceAngle01Rad01; // double rsNewHudu01 = faXian1Hudu01 + PId; //faXian1Hudu01; // PId - faXian1Hudu01; //注意这里是撞 左侧大圆(1号圆)的右侧弧! // int rsNewJiao1du = ceil(rsNewHudu01 * 180 / PId); // if (rsNewJiao1du < 0) rsNewJiao1du += 360; // if (rsNewJiao1du > 360) rsNewJiao1du -= 360; lightDuanlen01 = 0;// 1; if (IterativeAllTimes < 1900) {//if IterativeAllTimes < 1900 //判断是否和第一个圆相撞,则切换到 第2号圆////切换 去第 1号圆的判断(和Draw recursion01Draw02Circle02light03(hdc, 2, (long long)tt1new01, rsNewHudu01, RealX0001, RealY0001); //digui01DrawLine01light(hdc, tt1new01, rsNewJiao1du, RealX0001, RealY0001); }//if IterativeAllTimes < 1950//3000//1900 else { return 2; } if (C1s_rightTimes > 2) return 1; system("pause"); }//if11a10 //根据真实 实际坐标,描点成线--… // SetPixel(hdc, RealX0001, RealY0001, RGB(0, 200, 0)); //亮绿 //判断 是否 撞过 C2 圆2: //真实轴距离 //2号圆的左侧弧: //long long realDistanceAxesBetweenXY00001andC2 = (300-RealX0001) * (300-RealX0001) + (RealY0001-200) * (RealY0001-200); if /*1*/ ( (/*2*/2 == whichCircle/*2*/) && (/*2*/ (/*3*/realDistanceAxesBetweenXY00001andC2 >= 200 * 200 /*3*/) || ( RealX0001 <= 100 ) /*2*/) )/*1*/ {//if11a10 //if (/*1*/ 2 == whichCircle && RealX0001 <= 100 /*1*/) {//if11a10 ++C2s_leftTimes; cout << "C2s_leftTimes:" << C2s_leftTimes << endl; long long tt1new01 = tt - ii; //算法线: double faXian1Hudu01 = 0; // (double)-PId; //初始法线弧度为0!法线弧度为 // faXian1Hudu01 = atan((double)RealY0001-200.0) / (300.0-RealX0001 ); faXian1Hudu01 = asin( ((double)RealY0001 - 200.0) / 200 ); cout << "圆2号左侧faXian1Hudu01:" << faXian1Hudu01 << endl; // //画辅助线-法线 int x01x1 = RealX0001; int y01y1 = RealY0001; int x02x2 = 200 * cos((double)faXian1Hudu01) + RealX0001; int y02y2 = (200 * sin(-1 * (double)faXian1Hudu01) + RealY0001); MoveToEx(hdc, RealX0001, RealY0001, NULL); HPEN hPen; hPen = CreatePen(PS_SOLID, 1, RGB(0, 0,128)); // 创建一个蓝色的法线 SelectObject(hdc, hPen); // LineTo(hdc, x02x2, y02y2); //画法线 double rusheHudu_faxianhudu = incidenceAngle01Rad01 - faXian1Hudu01; rusheHudu_faxianhudu = faXian1Hudu01 - incidenceAngle01Rad01; cout << "[rusheHudu_faxianhudu:" << rusheHudu_faxianhudu << "]" << endl; // // double rsNewHudu01 = -(double)faXian1Hudu01;// -incidenceAngle01Rad01 + PId; // double rsNewHudu01 = -(double)faXian1Hudu01;// +(PId - incidenceAngle01Rad01); // -incidenceAngle01Rad01 + PId; cout << "撞圆2时的入射角弧度:" << incidenceAngle01Rad01<<endl; double rsNewHudu01 = -(double)faXian1Hudu01;// +getRs1Hudu_andFaxianJiajiao(faXian1Hudu01, incidenceAngle01Rad01); // double rsNewHudu01 = PId-(incidenceAngle01Rad01 -2 * faXian1Hudu01); rsNewHudu01 = -( faXian1Hudu01 - (PId - incidenceAngle01Rad01 - faXian1Hudu01)); //OK了 //;// +getHudu1bound180rad01(incidenceAngle01Rad01) - faXian1Hudu01;//;;// -getHudu1bound180rad01(incidenceAngle01Rad01);// +(PId - incidenceAngle01Rad01); // -incidenceAngle01Rad01 + PId; int rsNewJiao1du = 0;//faXian1Hudu01;//废弃 //ceil( (double)150 * PId / 180); ////rsNewHudu01 * 180 / PId; // if (rsNewJiao1du < 0) rsNewJiao1du += 360; // if (rsNewJiao1du > 360) rsNewJiao1du -= 360; lightDuanlen01 = 0;// 1; if (IterativeAllTimes < 1900) {//if IterativeAllTimes < 1900 lightDuanlen01 = 1; //切去第 1号圆的判断(和Draw cout << "[22:rsNewHudu01" << rsNewHudu01 << "]" << endl; //rsNewJiao1du废弃 recursion01Draw02Circle02light03(hdc, 1, tt1new01, rsNewHudu01, RealX0001, RealY0001); //digui01DrawLine01light(hdc, 1, tt1new01, rsNewHudu01, rsNewJiao1du, RealX0001, RealY0001); }//if IterativeAllTimes < 1950 if (C2s_leftTimes > 2) return 1; system("pause"); }//if11a10 //根据真实 实际坐标,描点成线--… COLORREF color01 = getColor1RGB1(IterativeAllTimes % 8); SetPixel(hdc, RealX0001, RealY0001, RGB(GetRValue(color01), GetGValue(color01), GetBValue(color01) ) ); //RGB(200, 0, 0)); //亮红 }//for1110 // return 1; }//int recursion01Draw02Circle02light03 // // int wm01paint01(HWND hWnd, PAINTSTRUCT ps, HDC hdc ) { //int wm01paint01(HWND hWnd, PAINTSTRUCT ps, HDC hdc) { // int C1_200_R01 = 200;//左圆半径(又称1号圆半径) // 圆的参数在前面定义过了,为全局变量了,所以此处略…… int tt1chushi_R01 = 200; int C1_R01 = 200; int C2_R02 = 200; //先画两竖线: int line1x01 = c1C2_Distance - C2_200_R02; int line2x02 = c1Xpianyi_X1 + C1_200_R01; MoveToEx(hdc, line1x01, 0, NULL); LineTo(hdc, line1x01, 2 * C1_200_R01); MoveToEx(hdc, line2x02, 0, NULL); LineTo(hdc, line2x02, 2 * C1_200_R01); //c1i01为角度变化,弧度需要计算 *π/180 //画两个圆 // double test1rad1 = double(hPi / 900 * 180) / 1000000000000000000; cout << "_PI=:" << setprecision(90) << test1rad1 << endl; //圆1号: for (int i1 = 0; i1 < 361; ++i1) {//fori100 double c1_rad1 = double(hPi / 900 * i1) / 1000000000000000000; //10^18 倍的(PI);hPi 是 1 / 2 PI(π)//注释:先除后乘以免 uint64存储溢出 // cout << endl; // cout << "c1_rad1:" << fixed << setprecision(30) << c1_rad1;// << endl; int c1_x001 = C1_200_R01 * cos(c1_rad1); int c1_y001 = C1_200_R01 * sin(c1_rad1); SetPixel(hdc, c1_x001, c1Ypianyi_Y1 + c1_y001, RGB(0, 128, 0)); //暗绿 }//fori100 cout << "_PI=:" << setprecision(90) << test1rad1 << endl; //圆2号: for (int i2 = 0; i2 < 350; ++i2) {//fori100 double c2_rad02 = double(hPi / 900 * i2) / 1000000000000000000; //10^18 倍的(PI);hPi 是 1 / 2 PI(π)//注释:先除后乘以免 uint64存储溢出 // cout << endl << "c2_rad1:" << fixed << setprecision(30) << c2_rad02;// << endl; int c2_x002 = C1_200_R01 * cos(c2_rad02); int c2_y002 = C1_200_R01 * sin(c2_rad02); SetPixel(hdc, c2Xpianyi_X2 + c2_x002, c2Ypianyi_Y2 + c2_y002, RGB(0, 128, 0)); //暗绿 }//fori100 // //根据 时间 tt 描点成线-start int light1R001 = 0;// 210;//发射光的初始半径 应大于200 int light1new01R001 = light1R001; int chushi1x001 = 190;// 200;// 0;// 190; int chushi1y001 = 200;// 0;// 200; //发光参数:// 参数 :0: hdc,1:which Circle 2:tt光线总长,3:入射弧度,4入射角度(废弃...角度非弧度), 5(当前)光线入口x坐标x01;6当前光线入口Y坐标Y01; //long long lightTlenth = 99992;// 9939;// 119;/// 191179;//光线长度 double lightIncidenceAngle = 0;// = -1.0 / 5 * 2 * hPi; //入射角 1/4π;因为: hPi*2=1*PI(1个π),最后乘hPi... lightIncidenceAngle = ((-1.0 / 4)* PId); // double(19.0) / 32 * PIld; //5.0 / 8 * PIld; //入射光 控制在(映像到): - 1/2PI --> 到 3/2PI 之间;如果在 3/2PI->2PI应该映像到 -1/2PI~~1/2PI之间 int Circle_Number = 1; recursion01Draw02Circle02light03(hdc, 1, lightTlenth, lightIncidenceAngle, 160, 200); //digui01DrawLine01light(hdc, tt, 125, 190, 200); // return 1; }//int wm01paint01 // 函数: WndProc(HWND, UINT, WPARAM, LPARAM) // // 目的: 处理主窗口的消息。 // // WM_COMMAND - 处理应用程序菜单 // WM_PAINT - 绘制主窗口 // WM_DESTROY - 发送退出消息并返回 // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // 分析菜单选择: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: {//case110 hdc = BeginPaint(hWnd, &ps); // TODO: 在此添加任意绘图代码... wm01paint01(hWnd, ps ,hdc); //wm01paint01(hWnd, ps, hdc); EndPaint(hWnd, &ps); }//case110//case WM_PAINT break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } // “关于”框的消息处理程序。 INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; } ```