RegisterClassEx function
Applies to: desktop apps only
Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.
Syntax
ATOM WINAPI RegisterClassEx( __in const WNDCLASSEX *lpwcx );
Parameters
- lpwcx [in]
-
Type: const WNDCLASSEX*
A pointer to a WNDCLASSEX structure. You must fill the structure with the appropriate class attributes before passing it to the function.
Return value
Type:
Type: ATOM
If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow, FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
If you register the window class by using RegisterClassExA, the application tells the system that the windows of the created class expect messages with text or character parameters to use the ANSI character set; if you register it by using RegisterClassExW, the application requests that the system pass text parameters of messages as Unicode. The IsWindowUnicode function enables applications to query the nature of each window. For more information on ANSI and Unicode functions, see Conventions for Function Prototypes.
All window classes that an application registers are unregistered when it terminates.
No window classes registered by a DLL are unregistered when the DLL is unloaded. A DLL must explicitly unregister its classes when it is unloaded.
Examples
For an example, see Using Window Classes.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | RegisterClassExW (Unicode) and RegisterClassExA (ANSI) |
See also
- Reference
- CreateWindow
- CreateWindowEx
- FindWindow
- FindWindowEx
- GetClassInfo
- GetClassInfoEx
- GetClassName
- RegisterClass
- UnregisterClass
- WindowProc
- WNDCLASSEX
- Conceptual
- Window Classes
Send comments about this topic to Microsoft
Build date: 2/3/2012
- 11/4/2009
- neptunecentury
- 7/22/2011
- mira003
Instead of trying to detect this using GetClassInfo(), a solution that does not work in a multi-threaded program due to a race condition; it is better to simply ignore the return value from this function and pick up the failure when CreateWindow() is called as that will fail due to "class not registered".
- 5/7/2009
- Chris_Guzak
- 11/23/2010
- Chris_Guzak