DirectX Game Programming-1. Create a blank Windows window

Source: Internet
Author: User

1#include <windows.h>2 3 #defineWin_class "Gameframe"//window class name4 #defineWin_name "Samplegame"//Window Title5 #defineWin_width 800//window Width6 #defineWin_height 600//Window Height7 8 9 //window Message handler functionTen LRESULT CALLBACK WndProc (HWND hwnd,uint msg,wparam wparam,lparam LPARAM) One { A     Switch(msg) -     { -      CaseWm_destroy: thePostQuitMessage (0); -          Break; -      CaseWm_lbuttonup: -MessageBox (NULL,"Hello directx!","Info", MB_OK); +          Break; -     } +     returnDefWindowProc (hwnd,msg,wparam,lparam); A } at  -  - //standard Win32 Program Entry - intWINAPI WinMain (hinstance hinstance, hinstance hprevinstance, LPSTR lpCmdLine,intnshowcmd) - { -Wndclassex wc={sizeof(Wndclassex), Cs_classdc,wndproc,0,0, Hinstance,loadicon (null,idi_application), LoadCursor (Null,idc_arrow), null,null,win_class,null}; inRegisterClassEx (&WC); -HWND hwnd=CreateWindow (Win_class,win_name,ws_overlappedwindow,cw_usedefault,cw_usedefault,win_width,win_height,null, Null,hinstance,null); to     if(hwnd==0) +     { -         return 0; the     } * ShowWindow (hwnd,nshowcmd); $ UpdateWindow (HWND);Panax Notoginseng msg msg; -ZeroMemory (&msg,sizeof(MSG)); the      while(msg.message!=wm_quit) +     { A         if(PeekMessage (&msg,null,0,0, Pm_remove)) the         { +TranslateMessage (&msg); -DispatchMessage (&msg); $         } $     } - Unregisterclass (win_class,wc.hinstance); -     return 0; the}

DirectX Game Programming-1. Create a blank Windows window

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.