实现 MyRegisterClass 窗口类注册逻辑 完成函数2

This commit is contained in:
2026-04-23 19:21:36 +08:00
parent b762332098
commit cecc694362
4 changed files with 18 additions and 3 deletions
+16 -1
View File
@@ -50,7 +50,22 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
{
// TODO(作业2): 注册窗口类。
UNREFERENCED_PARAMETER(hInstance);
return 0;
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_TETRIS));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_TETRIS);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)