In this article, I’ll guide you how to write C++ (pure, means no MFC, no ATL, no WTL, no CLR and no .Net) Win32 application (with the help of images). When writing pure Win32 programs, usually you see tutorials on internet or in help files shows how to use “RAW” windows, by filling a WNDCLASSEX structure, calling RegisterClassEx and then CreateWindowEx. This is explained in detail in Charles Petzold's classic Programming Windows book – a must-have for any Win32 programmer.
But sometimes you don’t need to create a new window entirely from scratch, a simple dialog box would fill your needs.
In this article, I’ll discuss how to use a Dialog Box as the main window for your program or application, from scratch. A dialog box resource can be quickly created – with labels, editboxes, and buttons with no controls adjusting (which take lots of work and time) – using any resource editor. Here I’ll use Visual Studio 2010, but the steps should be similar for other Visual Studio versions, or even other IDEs, just learn basic concept.
I’ll use pure Win32 C++ code to keep things as simple as possible: no MFC, no ATL, no WTL, or whatever. There is also the use of TCHAR functions (declared in tchar.h, more information click here) to make the code portable with ANSI and Unicode, and only functions that are both x86 and x64 compatible.