AllApi.net

[an error occurred while processing this directive]
 
'in a form
Private Sub Form_Load()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Dim ThreadID As Long, ProcessID As Long ' receive id to thread and process of Form1
    ' Determine the thread which owns this window
    ThreadID = GetWindowThreadProcessId(Me.hWnd, ProcessID)
    ' Use the callback function to list all of the enumerated thrad windows
    EnumThreadWindows ThreadID, AddressOf EnumThreadWndProc, 0
    'Show the results
    Me.AutoRedraw = True
    Me.Print sClasses
End Sub
'In a module
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Declare Function EnumThreadWindows Lib "user32" (ByVal dwThreadId As Long, ByVal lpfn As Long, ByVal lParam As Long) As Long
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
'variable used to list all the classnames
Public sClasses As String
Public Function EnumThreadWndProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
    Dim Ret As Long, sText As String
    'create a string-buffer
    sText = Space(255)
    'get the classname of the window handle
    Ret = GetClassName(hWnd, sText, 255)
    'cut off the unnecessary part of Chr$(0)'s
    sText = Left$(sText, Ret)
    'add this classname to the list of classnames
    sClasses = sClasses + sText + vbCrLf
    'continue the enumeration
    EnumThreadWndProc = 1
End Function


 
Copyright © 1998-2000, The KPD-Team.
Send mail to KPDTeam@Allapi.net with comments about this web site.
This site is located at
http://www.Allapi.net/