下面这一段程序,希望能给出详细解释(最好每一行都有)ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wce
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 03:19:09
下面这一段程序,希望能给出详细解释(最好每一行都有)ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wce
下面这一段程序,希望能给出详细解释(最好每一行都有)
ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_AAA); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_AAA; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); [D1] } BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); [D2] if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); [D3] UpdateWindow(hWnd); [D4] return TRUE; }
下面这一段程序,希望能给出详细解释(最好每一行都有)ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wce
ATOM MyRegisterClass(HINSTANCE hInstance)//注册窗口类 { WNDCLASSEX wcex;//声明变量 wcex.cbSize = sizeof(WNDCLASSEX); //WNDCLASSEX 的大小 wcex.style = CS_HREDRAW | CS_VREDRAW;//从这个窗口类派生的窗口具有的风格 wcex.lpfnWndProc = (WNDPROC)WndProc;//窗口处理函数的指针 wcex.cbClsExtra = 0;//指定紧跟在窗口类结构后的附加字节数 wcex.cbWndExtra = 0;//指定紧跟在窗口事例后的附加字节数 wcex.hInstance = hInstance;//本模块的事例句柄 wcex.hIcon = LoadIcon(hInstance,(LPCTSTR)IDI_AAA);//图标的句柄 wcex.hCursor = LoadCursor(NULL,IDC_ARROW);//光标的句柄 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);//背景画刷的句柄 wcex.lpszMenuName = (LPCSTR)IDC_AAA;//指向菜单的指针 wcex.lpszClassName = szWindowClass;//指向类名称的指针 wcex.hIconSm = LoadIcon(wcex.hInstance,(LPCTSTR)IDI_SMALL);//和窗口类关联的小图标 return RegisterClassEx(&wcex); [D1] //注册窗口类 } BOOL InitInstance(HINSTANCE hInstance,int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass,szTitle,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,0,CW_USEDEFAULT,0,NULL,NULL,hInstance,NULL); [D2] //创建 if (!hWnd) { return FALSE; } ShowWindow(hWnd,nCmdShow); [D3] //显示窗口 UpdateWindow(hWnd); [D4] //刷新窗口 return TRUE; }