UnregisterClassA function (winuser.h)

Unregisters a window class, freeing the memory required for the class.

Syntax

BOOL UnregisterClassA(
  [in]           LPCSTR    lpClassName,
  [in, optional] HINSTANCE hInstance
);

Parameters

[in] lpClassName

Type: LPCTSTR

A null-terminated string or a class atom. If lpClassName is a string, it specifies the window class name. This class name must have been registered by a previous call to the RegisterClass or RegisterClassEx function. System classes, such as dialog box controls, cannot be unregistered. 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 lpClassName; the high-order word must be zero.

[in, optional] hInstance

Type: HINSTANCE

A handle to the instance of the module that created the class.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the class could not be found or if a window still exists that was created with the class, the return value is zero. To get extended error information, call GetLastError.

Remarks

Before calling this function, an application must destroy all windows created with the specified class.

All window classes that an application registers are unregistered when it terminates.

Class atoms are special atoms returned only by RegisterClass and RegisterClassEx.

No window classes registered by a DLL are unregistered when the .dll is unloaded.

Note

The winuser.h header defines UnregisterClass as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in Windows 8)

See also

Conceptual

Reference

RegisterClass

RegisterClassEx

Window Classes