From 8b56ecc402c6e671eb200d1eb3cd12f9aec06477 Mon Sep 17 00:00:00 2001 From: blobt Date: Fri, 11 Sep 2020 08:31:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B6=88=E6=81=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 6db108b..7749d6e 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,19 @@ #include +/** +*消息处理函数 +*/ +LRESULT CALLBACK GLWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_CLOSE: + PostQuitMessage(0); + return 0; + } + return DefWindowProc(hwnd, msg, wParam, lParam); +} + INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { /*注册窗口*/ @@ -12,7 +26,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine wndclass.hIcon = NULL; wndclass.hIconSm = NULL; wndclass.hInstance = hInstance; - wndclass.lpfnWndProc = NULL; + wndclass.lpfnWndProc = GLWindowProc; wndclass.lpszClassName = L"GLWindow"; wndclass.lpszMenuName = NULL; wndclass.style = CS_VREDRAW | CS_HREDRAW;