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 WINAPI 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. |