Window class properties apply to all windows that belong to the class
Window class properties apply to all windows that belong to the class. That’s why they’re called class properties. This seems like an obvious thing to say when put in so many words, but I see many “solutions” that lose sight of this simple fact.
All the properties that you set in the
are window class properties,
as are the properties that you can access via
This means that
when you change those properties,
they affect the entire class.
For example, if you write
SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)hcurNew);
then you aren’t just changing the cursor for the window
You’re changing the cursor for all windows of the same class
For example, if
hwnd is an edit control,
then you changed the default cursor for all edit controls.
But what if you want to change a class property for just one particular window instead of for all windows of a class?
If you want to change the menu, background, cursor, or icon for a particular window, you can override the class default on a per-window basis: