Export (0) Print
Expand All

UnregisterClass function

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

Syntax


BOOL WINAPI UnregisterClass(
  _In_      LPCTSTR lpClassName,
  _In_opt_  HINSTANCE hInstance
);

Parameters

lpClassName [in]

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.

hInstance [in, optional]

Type: HINSTANCE

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

Return value

Type:

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.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

UnregisterClassW (Unicode) and UnregisterClassA (ANSI)

See also

Reference
RegisterClass
RegisterClassEx
Conceptual
Window Classes

 

 

Community Additions

ADD
Show:
© 2014 Microsoft