Jump to content
  • Advertisement
Sign in to follow this  
Drakkcon

Why does the win32 API use strings as class identifiers instead of handles?

This topic is 3206 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

It seems at odds with the rest of the API. Pretty much everything is based on handles like HWND and HMODULE, so I would expect that RegisterClass(Ex) would return an HCLASS. The ATOM behaves like a handle, but I still have to generate a string in my win32 wrapper. When I wasn't using a wrapper and was just using the naked SDK I usually ended up just using global constants anyway. So does anyone know?

Share this post


Link to post
Share on other sites
Advertisement
Like most older things in the API, the decision was probably made based on some condition or restriction that was only an issue 15 years ago.

Share this post


Link to post
Share on other sites
I would say it's because class names are for more than just registering your own class. There's also the "well-known" class names such as "BUTTON", "EDIT", "LISTBOX", etc. They need to be strings so that you can refer to them in external files (like dialog templates).

That's my guess anyway.

Share this post


Link to post
Share on other sites
Quote:
Original post by Codeka
I would say it's because class names are for more than just registering your own class. There's also the "well-known" class names such as "BUTTON", "EDIT", "LISTBOX", etc. They need to be strings so that you can refer to them in external files (like dialog templates).

That's my guess anyway.


Yeah, I guess you're right, that's a good reason for their existence.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!