Results 1 to 4 of 4

Thread: Window ClassName

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    22

    Unhappy

    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

  2. #2
    Guest
    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

  3. #3
    Guest
    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.





  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    22

    Cool

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width