RegisterClass the function name and its parameters to explain, Chinese meaning is registered window category, as the name implies is registered a window class, and CreateWindow literally means to create a window. Maybe just doing Windows development has a bit of a problem with the two functions and their association.
The role of the RegisterClass function is to inform the system that you want to define a new form type and then record that type into the system, and then you can use CreateWindow to create a form based on this type. Forms based on this type have the same properties, such as background color, cursor, icon, and so on. In MFC, for dialog boxes, the system has already registered the dialog box's own type, so you can use your own dialog class to create modal or non-modal windows without calling RegisterClass.
For a control, the system has registered the dialog box's own type, so you can use CreateWindow to create the control without calling RegisterClass, and the first parameter in CreateWindow It is the member lpszClassName in the WNDCLASS structure that is used by the RegisterClass function.
The difference between a Windows control and a dialog box is that the form procedure for a dialog box is provided by the caller, and the form procedure for the control is defined in the system, and you must subclass the form (so-called subclasses can refer to my previous "subclass and Superclass Differences" article) in order to customize the processing message logic of the control.
In fact, plainly, as early as the C language window programming era, has supported the inheritance, which for the future C + + language implementation laid the foundation. The role of the RegisterClass function is to define a form class, relative to the class concept in C + +, and CreateWindow This function is to define an object based on this type, relative to the concept of an object in C + +.
About RegisterClass and CreateWindow