WNDCLASS Structure

Type WNDCLASS
  style As Long
  lpfnWndProc As Long
  cbClsExtra As Long
  cbWndExtra As Long
  hInstance As Long
  hIcon As Long
  hCursor As Long
  hbrBackground As Long
  lpszMenuName As String
  lpszClassName As String
End Type

Description & Usage

The WNDCLASS structure holds most of the information defining a window class. This information is used by any windows which belong to the class. The only item which this structure does not hold is a handle to the class's small icon. (The more advanced WNDCLASSEX structure does.)

Visual Basic-Specific Issues

None.

Data Members

style
A combination of the following flags specifying various styles to give to windows which belong to the class:
CS_BYTEALIGNCLIENT
Align the window's client area horizontally on the byte boundary.
CS_BYTEALIGNWINDOW
Align the window horizontally on the byte boundary.
CS_CLASSDC
Have all windows belonging to the class use a single shared device context used by all threads.
CS_DBLCLKS
Send a double-click message to the window procedure whenever the user double-clicks the mouse inside the window.
CS_GLOBALCLASS
Allow any application to create a window from this class. (If this flag is not specified, only the instance registering the class is allowed to use it.) The window class must be defined in a dynamic link library loaded at startup.
CS_HREDRAW
Redraw the entire window if a movement or size change alters the width of the window's client area.
CS_NOCLOSE
Disable the Close command on the window's menu.
CS_OWNDC
Give each window belonging to the class its own device context.
CS_PARENTDC
Set the clipping region of a child window equal to that of its parent window, allowing the child to draw on the parent.
CS_SAVEBITS
Save as a bitmap the portion of the screen image obscured by the window. This bitmap is then used to redraw the screen when the window is removed. Using this consumes more resources.
CS_VREDRAW
Redraw the entire window if a movement or size change alters the height of the window's client area.
lpfnWndProc
A pointer to the WindowProc hook function used for the window procedure which processes all of messages of each window belonging to the class.
cbClsExtra
The number of extra bytes to allocate following the window class structure for additional storage.
cbWndExtra
The number of extra bytes to allocate following the window instance structure for additional storage.
hInstance
A handle to the instance which contains the window procedure for the class.
hIcon
A handle to the window class's icon.
hCursor
A handle to the window class's cursor.
hbrBackground
A handle to the brush used to fill the window's background area. This can also be one of the following flags specifying the system color to use as the background color:
COLOR_ACTIVEBORDER
The color of an active window's border.
COLOR_ACTIVECAPTION
The color of an active window's caption.
COLOR_APPWORKSPACE
The color of an application's workspace.
COLOR_BACKGROUND
The color of the desktop background.
COLOR_BTNFACE
The color of a button's face.
COLOR_BTNHIGHLIGHT
The color of a button's highlight area.
COLOR_BTNSHADOW
The color of a button's shadow area.
COLOR_BTNTEXT
The color of a button's text.
COLOR_CAPTIONTEXT
The color of an active window's caption area's text.
COLOR_GRAYTEXT
The color of grayed-out text.
COLOR_HIGHLIGHT
The color of a highlight.
COLOR_HIGHLIGHTTEXT
The color of text in a highlight.
COLOR_INACTIVEBORDER
The color of an inactive window's border.
COLOR_INACTIVECAPTION
The color of an inactive window's caption.
COLOR_INACTIVECAPTIONTEXT
The color of an inactive window's caption area's text.
COLOR_MENU
The color of a menu.
COLOR_MENUTEXT
The color of a menu's text.
COLOR_SCROLLBAR
The color of a scrollbar.
COLOR_WINDOW
The color of a window.
COLOR_WINDOWFRAME
The color of a window's frame.
COLOR_WINDOWTEXT
The color of a window's text.
lpszMenuName
The name of the window class's menu resource, if any.
lpszClassName
The name of the window class.

Constant Definitions

Const CS_BYTEALIGNCLIENT = &H1000
Const CS_BYTEALIGNWINDOW = &H2000
Const CS_CLASSDC = &H40
Const CS_DBLCLKS = &H8
Const CS_HREDRAW = &H2
Const CS_NOCLOSE = &H200
Const CS_OWNDC = &H20
Const CS_PARENTDC = &H80
Const CS_SAVEBITS = &H800
Const CS_VREDRAW = &H1
Const COLOR_ACTIVEBORDER = 10
Const COLOR_ACTIVECAPTION = 2
Const COLOR_APPWORKSPACE = 12
Const COLOR_BACKGROUND = 1
Const COLOR_BTNFACE = 15
Const COLOR_BTNHIGHLIGHT = 20
Const COLOR_BTNSHADOW = 16
Const COLOR_BTNTEXT = 18
Const COLOR_CAPTIONTEXT = 9
Const COLOR_GRAYTEXT = 17
Const COLOR_HIGHLIGHT = 13
Const COLOR_HIGHLIGHTTEXT = 14
Const COLOR_INACTIVEBORDER = 11
Const COLOR_INACTIVECAPTION = 3
Const COLOR_INACTIVECAPTIONTEXT = 19
Const COLOR_MENU = 4
Const COLOR_MENUTEXT = 7
Const COLOR_SCROLLBAR = 0
Const COLOR_WINDOW = 5
Const COLOR_WINDOWFRAME = 6
Const COLOR_WINDOWTEXT = 8

Used By

GetClassInfo, RegisterClass

Go back to the alphabetical Structure listing.
Go back to the Reference section index.


Last Modified: August 22, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/w/wndclass.html