2012 in review December 31, 2012
The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.
Here’s an excerpt:
600 people reached the top of Mt. Everest in 2012. This blog got about 12,000 views in 2012. If every person who reached the top of Mt. Everest viewed this blog, it would have taken 20 years to get that many views.
Lesson 6: Command events & notifications < February 5, 2012
- Contents of this lesson:
- > Conceptual: how events are served to your code one at a time.
- > Basic command event handling in HTML.
- > Basic API-level command event handling for Windows windows.
- >
WM_COMMANDas command versusWM_COMMANDas notification. - > Posting versus sending of messages.
This lesson’s main points:
- User commands are represented by simple integer identifiers, no arguments.
- Hierarchical menus can be defined as resources.
- To get XP/Vista/Windows 7 look and feel for e.g. buttons, one can include a suitable XML “manifest” resource.
- The Windows API conflates user commands with child-to-parent window notifications in
WM_COMMANDmessages, and failure to properly differentiate these message meanings can cause e.g. undesirable infinite (or very deep) recursion or iteration. - The API is designed for hierarchical centralized control (C++ frameworks can use message reflection to implement a more object oriented distributed local control paradigm).
Lesson 5: Window message basics < January 8, 2012
- Contents of this lesson:
- > The power and limits of resources.
- > Packed message arguments, manual unpacking.
- > Use a separate message handler function for each message.
- > Unpack arguments via undocumented message cracker macros.
- > Be pedantically correct: support message results.
This lesson’s main points:
- Windows window messages are much like C++ virtual functions.
- The packing and unpacking of messages, having messages as data, introduces some complexity.
- Dialog procedures impose special (complex) requirements on message handling.
Lesson 4: Dialogs and resources < December 28, 2011
- Contents of this lesson:
- > Concepts: window messages, window styles, embedded resources.
- > Embed your first concrete resource: an application icon.
- > Specifying resources: pseudo-pointers and number strings.
- > Handling
WM_INITDIALOG& sendingWM_SETICON. - > Controls & specifying a dialog via a resource.
This lesson’s main points:
- A general window has an associated callback function (e.g. dialog procedure) that is called every time something happens to the window, and that serves as your main customization point.
- Some functionality and effects, such as resizing ability, can be turned off/on via window style bits.
- Windows supports embedding data, called resources, in executables and DLLs.
Lesson 3: The textual process arguments < December 20, 2011
- Contents of this lesson:
- > The C++
mainfunction signature - > Process arguments versus the standard
mainsignature - > The command line
- > The process’s current directories
- > The process environment
This lesson’s main points:
- The standard
mainarguments are ungood for serious Windows programming. - Each Windows process has multiple current directories, one per drive, just like in DOS.
- Much Windows programming support code is roughly the same in many programs (think reuse).
One reaction to this posting was that it must surely be irrelevant to Windows GUI programming. Command line, main arguments? Hey?
Well that’s where it all starts, e.g. when you double-click a file to just “open” it: the program then receives the file name via a command line, which in standard C++ ends up as individual arguments to main.
And one interesting fact is that the C++ standard main signature is utterly useless for reliably transferring such file names in Windows.
Lesson 2: The API is based on Unicode < December 13, 2011
Tags: c++, precompiled headers, visual c++, visual c++ express, visual studio, windows api, winmain
- Contents of this lesson:
- > Unicode versus ANSI
- > Why
UNICODEshould be defined in the source code - > How to include the [windows.h] header file in C++
This lesson’s main points:
- The Windows API is based on UTF-16 encoded text, called “Unicode”.
- In C++ that means using the
wchar_ttype, & friends. - Microsoft’s
T…-macros support Windows 9x, if you want that.
Lesson 1: Tools need configuration < December 9, 2011
Tags: c++, precompiled headers, visual c++, visual c++ express, visual studio, windows api, winmain
- Contents of this lesson:
- > The tools
- > The automatically generated GUI program
- > Configure the IDE: full menus, please!
- > Configure the project: standard C++
main, please! - > Configure the project: standard C++ preprocessing, please!
This lesson’s main point:
- If you want full functionality, and/or if you want ISO C++ standard compliance, then it’s necessary to configure the tools.