TN070: MFC Window Class Names
MFC windows use a dynamically created class name that reflects the features of the window. MFC generates class names dynamically for frame windows, views, and popup windows produced by the application. Dialog boxes and controls produced by an MFC application have the Windows-supplied name for the class of window in question.
You can replace the dynamically provided class name by registering your own window class and using it in an override of PreCreateWindow. Their MFC-supplied class names fit one of the two following forms:
Afx:%x:%x
Afx:%x:%x:%x:%x:%x
The hex digits that replace the %x
characters are filled in from data from the structure. MFC uses this technique so that multiple C++ classes requiring identical WNDCLASS structures can share the same registered window class. Unlike most simple Win32 applications, MFC applications have only one WNDPROC, so you can easily share WNDCLASS structures to save time and memory. The replaceable values for the %x
characters shown above are as follows:
WNDCLASS.hInstance
WNDCLASS.style
WNDCLASS.hCursor
WNDCLASS.hbrBackground
WNDCLASS.hIcon
The first form (Afx:%x:%x
) is used when hCursor, hbrBackground, and hIcon are all NULL.