Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. 'RegisterClass' - MS Documentation Error?

'RegisterClass' - MS Documentation Error?

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiocomjsonhelpquestion
9 Posts 4 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bram van Kampen
    wrote on last edited by
    #1

    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

    Richard Andrew x64R D L 5 Replies Last reply
    0
    • B 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

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      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.

      B 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        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.

        B Offline
        B Offline
        Bram van Kampen
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • B 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

          D Offline
          D Offline
          Daniel Pfeffer
          wrote on last edited by
          #4

          lpszClassName
          Type: LPCTSTR

          A 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

          1 Reply Last reply
          0
          • B 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

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            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.

            B 1 Reply Last reply
            0
            • B 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

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • B 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

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • L Lost User

                  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.

                  B Offline
                  B Offline
                  Bram van Kampen
                  wrote on last edited by
                  #8

                  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

                  L 1 Reply Last reply
                  0
                  • B 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

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    I suspect it has always been a bit confusing. BTW sorry about the duplicate messages, something weird going on at CP tonight.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups