CURRENT WORK ITEM - PREVIEW ONLY

RegisterClassNameW

Declaration

BOOLEAN RegisterClassNameW (PCWSTR lpClassName);

Parameters

The lpClassName argument provides the name of a window class to register.

Return Value

The function returns FALSE to indicate failure. Anything else is success.

Behaviour

If the given name is that of a supported window class, the function registers the window class. The function succeeds if the registration succeeds or if the reason for failure is that the class is already registered.

The name is case-insensitive. The following window classes are presently supported:

Button, ComboBox, ComboBoxEx32, ComboLBox, DropDown, Edit, ImageDrag, ListBox, msctls_hotkey32, msctls_progress32, msctls_statusbar32, msctls_trackbar32, msctls_updown32, NativeFntCtl, ReaderModeCtl, RebarWindow32, ScrollBar, Static, SysAnimate32, SysDateTimePick32, SysHeader32, SysIPAddress32, SysLink, SysListView32, SysMonthCal32, SysPager, SysTabControl32, SysTreeView32, ToolbarWindow32, tooltips_class32

The traditional way to ensure that the window classes for common controls are registered in advance of trying to create any controls is to call the InitCommonControlsEx function, with flags to specify which controls are wanted. Though this remains a valid technique, it is made redundant by RegisterClassNameW. Indeed, it may be that the only reason COMCTL32 implements the RegisterClassNameW function is to provide that COMCTL32 clients can create common controls without an earlier call to InitCommonControlsEx.

Availability

The RegisterClassNameW function is exported by name from COMCTL32.DLL in late 5.82 builds, and late 6.00 builds, and higher. Of the window classes that are exposed through this function, DropDown and ImageDrag require at least version 6.10.

Note that this function is not specific to COMCTL32. It can usefully be implemented by any module that has an assembly manifest that names a window class. It happens that the only such module in the Windows Vista package is COMCTL32, and only COMCTL32 implements this function.

Though this function dates from 2001, it was still not documented by Microsoft as late as the January 2007 edition of the Software Development Kit (SDK) for Windows Vista.