Hi,
I'm a beginer in VB, so i want to know what is exactly the classname and if it's always the same for each window (exemple : IE window have always the same classname)
Thanks
Printable View
Hi,
I'm a beginer in VB, so i want to know what is exactly the classname and if it's always the same for each window (exemple : IE window have always the same classname)
Thanks
The Classname always stays the same. Classname is another way to identify a window. Same as getting it's hwnd. Here is an example of how to get the classname:
Code:Declare Function GetClassName Lib "user32.dll" _
Alias "GetClassNameA" (ByVal hWnd As Long, ByVal _
lpClassName As String, ByVal nMaxCount As Long) As Long
Private Sub Command1_Click()
' 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
End Sub
The ClassName is the group of the specified Window. Here is an analogy: You and I belong to a "class" called Humans. Our computers, walkmans and TV's belong to a "class" called Machines.
Thanks