Tutorials
|
|
Menu of tutorialsTutorial 1: The Simplest Window
Tutorial 1: The Simplest WindowThe following code uses Win32++ to create a window. This is all the code you need (in combination with Win32++) to create and display a simple window. Note that in order to add the Win32++ code to our program, we use an #include statement as shown below. #include "wxx_wincore.h" // Note: // Add the Win32++\include directory to project's additional include directories // A class that inherits from CWnd. It is used to create the window. class CMyWindow : public CWnd { public: CMyWindow() {} virtual void OnDestroy() { PostQuitMessage(0); } // Ends the program virtual ~CMyWindow() {} }; int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { // Start Win32++ CWinApp MyApp; // Create a CMyWindow object CMyWindow MyWindow; // Create (and display) the window MyWindow.Create(); // Run the application's message loop return MyApp.Run(); } This program has four key steps:
The
The source code for this tutorial is located within the Tutorial folder of the software available from SourceForge at http://sourceforge.net/projects/win32-framework. |