This example creates a dialog program using the CWINDOWIMPL class. Step 1: Create a new Win32 Application Engineering.
Step 2: In the stdafx.h, the following three rows are included.
#include
Step 3: Write the WinMain function, as follows:
Int apientry Winmain (Hinstance Hinstance, Hinstance, LPSTR, INT) {_ module.init (null, hinstance);
// Create an instance of cmcbwindowcmcbwindow atlwnd; atlwnd.create (null, cwindow :: rcdefault, _t ("mahesh's atl window", ws_overlappedwindow | ws_visible);
Msg Msg; While (GetMessage (& MSG, NULL, 0, 0)) {TranslateMessage (& MSG); DispatchMessage (& MSG);
_Module.Term (); return msg.wparam;} Step 4: Inheriting the CMCBWindow class from CWindowImpl:
// NOTE: See the template parameter Its CMcbWindowclass CMcbWindow:. Public CWindowImpl
// this function will Paint A Hello Mindcracker String Lresult Onpaint (Uint, WPARAM, LPARAM, BOOL &) {PAINTSTRUCT PS; HDC HDC = Getdc (); BeginPaint (& PS); Textout (HDC, 0, 0, _t ("Hello Mindcracker "), 17); Endpaint (& PS); Return 0;}
LResult, WParam, LParam, Bool &) {PostquitMessage (0); return 0;}}; fifth step: Define ccommodule _Module:
// atlwnd.cpp: Defines the entry point for the application. # Include "stdafx.h" ccommodule _module; Final: Compiling execution.