'RegisterClass' - MS Documentation Error?
-
Hi, The Documentation for RegisterClass, or RegisterClassEX, states that the Name of the class to be registered must be a name previously registered with either of these API Calls. (by way of Atom, or Text String). https://msdn.microsoft.com/en-us/library/windows/desktop/ms633577(v=vs.85).aspx[^] I Understood always that Window Class Names should be Unique, and, that to register a Window Class by a Previously registered name, would (or should) constitute an Error. I am not sure whether Windowclass Registration is per process or System Wide. I Suspect the former, but, the Documentation does not say. Do I totally misunderstand the system, or, is the MS Documentation Wrong on this point. :)
Bram van Kampen
-
Hi, The Documentation for RegisterClass, or RegisterClassEX, states that the Name of the class to be registered must be a name previously registered with either of these API Calls. (by way of Atom, or Text String). https://msdn.microsoft.com/en-us/library/windows/desktop/ms633577(v=vs.85).aspx[^] I Understood always that Window Class Names should be Unique, and, that to register a Window Class by a Previously registered name, would (or should) constitute an Error. I am not sure whether Windowclass Registration is per process or System Wide. I Suspect the former, but, the Documentation does not say. Do I totally misunderstand the system, or, is the MS Documentation Wrong on this point. :)
Bram van Kampen
The page that you link to is the page for the WNDCLASSEX structure, not the RegisterClass or RegisterClassEx function. Therefore when it refers to a class name that has been previously registered, it does so only to describe what the structure should contain. It's not telling you to register a class name more than once.
The difficult we do right away... ...the impossible takes slightly longer.
-
The page that you link to is the page for the WNDCLASSEX structure, not the RegisterClass or RegisterClassEx function. Therefore when it refers to a class name that has been previously registered, it does so only to describe what the structure should contain. It's not telling you to register a class name more than once.
The difficult we do right away... ...the impossible takes slightly longer.
No, the Link is Correct. The offending piece of Text is in the explanation about "lpszClassName" in the WNDCLASS(EX) structure. A Good bit down the File! Regards, :)
Bram van Kampen
-
Hi, The Documentation for RegisterClass, or RegisterClassEX, states that the Name of the class to be registered must be a name previously registered with either of these API Calls. (by way of Atom, or Text String). https://msdn.microsoft.com/en-us/library/windows/desktop/ms633577(v=vs.85).aspx[^] I Understood always that Window Class Names should be Unique, and, that to register a Window Class by a Previously registered name, would (or should) constitute an Error. I am not sure whether Windowclass Registration is per process or System Wide. I Suspect the former, but, the Documentation does not say. Do I totally misunderstand the system, or, is the MS Documentation Wrong on this point. :)
Bram van Kampen
lpszClassName
Type: LPCTSTRA pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpszClassName; the high-order word must be zero.
If lpszClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the RegisterClassEx function will fail.
As I read this, the lpszClassName member must be either an atom or a string. Only if it is an atom must the atom be one created by a previous call to the RegisterClass() or RegisterClassEx() APIs. In my experience, most programmers use a string for this member.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill
-
Hi, The Documentation for RegisterClass, or RegisterClassEX, states that the Name of the class to be registered must be a name previously registered with either of these API Calls. (by way of Atom, or Text String). https://msdn.microsoft.com/en-us/library/windows/desktop/ms633577(v=vs.85).aspx[^] I Understood always that Window Class Names should be Unique, and, that to register a Window Class by a Previously registered name, would (or should) constitute an Error. I am not sure whether Windowclass Registration is per process or System Wide. I Suspect the former, but, the Documentation does not say. Do I totally misunderstand the system, or, is the MS Documentation Wrong on this point. :)
Bram van Kampen
Bram van Kampen wrote:
Do I totally misunderstand
No, but I think the documentation is not as clear as it could be. The structure may be used either for registering a new class, or for querying an existing one (GetClassInfoEx[^]). In the case of
RegisterClass
the class name should be a string that is not already used for any other class. -
Hi, The Documentation for RegisterClass, or RegisterClassEX, states that the Name of the class to be registered must be a name previously registered with either of these API Calls. (by way of Atom, or Text String). https://msdn.microsoft.com/en-us/library/windows/desktop/ms633577(v=vs.85).aspx[^] I Understood always that Window Class Names should be Unique, and, that to register a Window Class by a Previously registered name, would (or should) constitute an Error. I am not sure whether Windowclass Registration is per process or System Wide. I Suspect the former, but, the Documentation does not say. Do I totally misunderstand the system, or, is the MS Documentation Wrong on this point. :)
Bram van Kampen
Bram van Kampen wrote:
Do I totally misunderstand
No, but I think the documentation is not as clear as it could be. The structure may be used either for registering a new class, or for querying an existing one (GetClassInfoEx[^]). In the case of
RegisterClass
the class name should be a string that is not already used for any other class. -
Hi, The Documentation for RegisterClass, or RegisterClassEX, states that the Name of the class to be registered must be a name previously registered with either of these API Calls. (by way of Atom, or Text String). https://msdn.microsoft.com/en-us/library/windows/desktop/ms633577(v=vs.85).aspx[^] I Understood always that Window Class Names should be Unique, and, that to register a Window Class by a Previously registered name, would (or should) constitute an Error. I am not sure whether Windowclass Registration is per process or System Wide. I Suspect the former, but, the Documentation does not say. Do I totally misunderstand the system, or, is the MS Documentation Wrong on this point. :)
Bram van Kampen
Bram van Kampen wrote:
The Documentation for RegisterClass, or RegisterClassEX, states that the Name of the class to be registered must be a name previously registered with either of these API Calls. (by way of Atom, or Text String).
What it actually states is:
Quote:
If lpszClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
That means when you call
RegisterClass(Ex)
you must provide the class name. -
Bram van Kampen wrote:
Do I totally misunderstand
No, but I think the documentation is not as clear as it could be. The structure may be used either for registering a new class, or for querying an existing one (GetClassInfoEx[^]). In the case of
RegisterClass
the class name should be a string that is not already used for any other class.So, the Latest Update to this Help article was written by the Lass or Bloke who wrote 'GetClassInfoEx()', without thinking that the same struct is used by RegisterClass(Ex). Well, at least not a Fundamental API Change. Regards, :)
Bram van Kampen
-
So, the Latest Update to this Help article was written by the Lass or Bloke who wrote 'GetClassInfoEx()', without thinking that the same struct is used by RegisterClass(Ex). Well, at least not a Fundamental API Change. Regards, :)
Bram van Kampen