Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
GetClassName retrieves the name of the window class to which a window belongs. The name of the class is placed into the string passed as lpClassName.
If an error occured, the function returns 0 (use GetLastError to get the error code). If successful, the function returns the number of characters copied into the string passed as lpClassName.
None.
' This code is licensed according to the terms and conditions listed here.
' Display the name of the window class to which window Form1 belongs.
Dim classname As String ' receives the name of the class
Dim slength As Long ' length of the string retrieved
' Make room in the string to receive the information.
classname = Space(255) ' much more than enough room
' Get the name of the window class.
slength = GetClassName(Form1.hWnd, classname, 255)
' Extract the useful information from the string and display it.
classname = Left(classname, slength) ' remove empty space
Debug.Print "Form1's window class is: "; classname
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/getclassname.html