GetClassName

The GetClassName function retrieves the name of the class to which the specified window belongs.

int GetClassName(
  HWND hWnd,           // handle of window
  LPTSTR lpClassName,  // address of buffer for class name
  int nMaxCount        // size of buffer, in characters
);
 

Parameters

hWnd
Handle to the window and, indirectly, the class to which the window belongs.
lpClassName
Pointer to the buffer that is to receive the class name string.
nMaxCount
Specifies the length, in characters, of the buffer pointed to by the lpClassName parameter. The class name string is truncated if it is longer than the buffer.

Return Values

If the function succeeds, the return value is the number of characters copied to the specified buffer.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 1.0 or later.
  Header: Declared in winuser.h.
  Import Library: Use user32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Window Classes Overview, Window Class Functions, FindWindow, GetClassInfo, GetClassLong, GetClassWord