Tham khảo tài liệu 'beginning game programming (phần 2)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 30 Chapter 2 Windows Programming Basics Figure A new source file has been added to the project ready for your source code. int WINAPI WinMain HINSTANCE hInstance HINSTANCE hPrevInstance LPSTRIpCmdLine intnShowCmd MessageBox NULL Motoko Kusanagi has hacked your system Public Security Section 9 MB_OK MB_ICONEXCLAMATION This program simply displays a dialog box on the screen as shown in Figure . What is the most important thing you should glean from this example That WinMain does not need to be a big ugly complex hodge-podge of app code. When you compile a program with Visual C the executable file is located in a folder called Debug inside your project s folder . The Basics of a Windows Program 31 Figure Output from the Hello World program In the tradition of climbing the learning curve I ll expand this little example a bit and show you how to create a standard program window and draw on it. This is the next step before you actually learn to initialize and use Direct3D. Now that you ve seen what a very simple Windows program looks like let s delve a little further into the magical realm of Windows programming and learn to create a real window and draw stuff on it using MessageBox is a bit of a cheat What you really want is your very own window which you ll create in the next chapter. Ironically you won t need a main program window when you start writing DirectX code because DirectX interfaces directly with the video card. The one exception would be if you were to write DirectX programs that run in a window. In my opinion doing this defeats the purpose of DirectX though because a game shouldn t run in a window it should always without exception run fullscreen. Do you want players focusing on your game or on instant messages and e-mail Understanding WinMain As you have just learned every Windows program has a function called WinMain. WinMain is the Windows equivalent of the main function in standard C programs and is the initial entry point for a Windows .