What's the purpose of registering window classes? What's the purpose of registering window classes? windows windows

What's the purpose of registering window classes?


The separation of window attributes into CreateWindow() stuff and RegisterClass() stuff was done early on to enable the creation of uniformly-behaving windows. Dialog controls (buttons, listboxes, etc.) are a prime example - they all share a class. That means - they share a window procedure, that means - they share painting logic, input reactions, custom messages, notifications, etc.

On the app level, the most typical case when you have many windows of the same class is documents within a multiple-document interface. Sometimes people introduce app-specific controls. So the distinction serves its purpose.


Main purpose is giving the system the right WndProc to call when there is something in the message queue to process.

There are some flags, but main point is the above.

Window classes correspond to types of 'widgets' on the UI:

  • button
  • checkbox
  • scrollbar
  • combobox
  • listbox

WndProc is the sole driver of the behavior of the widget.

Hence the mapping: widget (control type) -> wndclass -> WndProc