Directx初始化表單

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.