Directx初始化窗体

#include <windows.h> #include <d3dx9.h> HINSTANCE hInstance; LRESULT CALLBACK WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, uMsg, wParam, lParam); } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { MSG msg; ZeroMemory(&msg, sizeof(MSG)); WNDCLASSEX wc; wc.cbClsExtra = 0; wc.cbSize = sizeof(wc); wc.cbWndExtra = 0; wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hIconSm = NULL; wc.hInstance = hInstance; wc.lpfnWndProc = WinProc; wc.lpszClassName = "refind"; wc.lpszMenuName = NULL; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; RegisterClassEx(&wc); HWND hWnd; hWnd = CreateWindowEx(WS_EX_APPWINDOW, "refind", "refind", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 800, 600, NULL, NULL, hInstance, NULL); ShowWindow(hWnd, SW_NORMAL); UpdateWindow(hWnd); while(msg.message != WM_QUIT) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } else {} } return 0; }

你可能感兴趣的:(Directx初始化窗体)