Utah C++ Programmers has released a new video:
by Richard Thomson
From the video description:
The Win32 Windows API has been around for decades as a C API for GUI applications. At its heart, every Win32 application is a program that receives messages from Windows, decodes those messages and dispatches them to appropriate code for handling the message.
Graphical user interfaces are a natural fit for object oriented programming and C++ GUI frameworks like MFC (Microsoft Foundation Classes) were created to make writing GUI applications easier.
As Win32 applications evolved to incorporate COM (Component Object Model) objects, a need to write small components adhering to well defined interfaces became more important. Writing such components with MFC results in a heavyweight object and additional deployment dependencies. C++ libraries like ATL (Active Template Library) addressed the need to create interoperable binary components that were lightweight with minimal or no deployment dependencies.
The Windows Template Library (WTL) took the lessons learned from writing small COM objects with ATL and applied them to writing complete Win32 applications. The result is a complete library for writing Win32 applications using the static polymorphism of templates instead of the dynamic polymorphism of MFC.
Are there other ways to look at writing Win32 applications?
WinLamb is similar to WTL in that they are both header-only libraries that wrap the Win32 API. While a WTL program uses message map macros to select the appropriate handler for a message, WinLamb uses lambda functions for the message handlers and an internal dispatching mechanism.
This month, Richard Thomson will give us a walk through of using WinLamb to create Win32 applications. We'll look at how to create an application from scratch with CMake and using the project wizard in Visual Studio. (Since our application isn't cross-platform, but Windows only, we won't lose anything by using Visual Studio's wizard.)
From this skeleton application, we'll look at:
- how to add message handlers to the main window
- how to add controls to the main window
- how to define and use resources
- how to use a dialog box as the main window
- how to separate GUI logic from application logic
- Win32 API helpers provided by WinLamb