GetClassInfo Function

Declare Function GetClassInfo Lib "user32.dll" Alias "GetClassInfoA" (ByVal hInstance As Long, ByVal lpClassName As String, lpWndClass As WNDCLASS) As Long

Platforms

Description & Usage

GetClassInfo retrieves most of the information associated with a window class. The information is placed into the structure passed as lpWndClass.

Return Value

If an error occured, the function returns 0 (use GetLastError to get the error code). If successful, the function returns a non-zero value.

Visual Basic-Specific Issues

None.

Parameters

hInstance
A handle to the instance which owns the window class, or 0 if the window class is defined by the operating system.
lpClassName
The name of the window class to retrieve information about.
lpWndClass
Receives the information about the window class.

Example

' This code is licensed according to the terms and conditions listed here.

' Draw the icon and cursor from the window class to which window
' Form1 belongs.  The two images are drawn on Form1.
Dim classinfo As WNDCLASS  ' receives the class information
Dim classname As String  ' receives the name of the window class
Dim slength As Long  ' the length of the window class's name
Dim retval As Long  ' return value

' First, get the name of the window class to which Form1 belongs.
classname = Space(255)  ' make enough room in the buffer
slength = GetClassName(Form1.hWnd, classname, 255)  ' get the name
classname = Left(classname, slength)  ' remove the empty space

' Get the information about the window class.  Since this is a Visual Basic-
' generated window, its window class belongs to the application.
retval = GetClassInfo(App.hInstance, classname, classinfo)

' Now draw the window class's icon and cursor on window Form1.
' Draw the icon.
retval = DrawIconEx(Form1.hDC, 0, 0, classinfo.hIcon, 0, 0, 0, 0, DI_NORMAL)
' Draw the cursor.  If it's animated, draw only the first frame of it.
retval = DrawIconEx(Form1.hDC, 50, 0, classinfo.hCursor, 0, 0, 0, 0, DI_NORMAL)

See Also

GetClassInfoEx, GetClassLong

Category

Window Classes

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


Last Modified: August 21, 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/g/getclassinfo.html