Sign in to follow this  
Drakkcon

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

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this