[VB 6/98]Thread finden beenden

Hallo,

Ich möchte einen laufenden Thread über den Namen finden und beenden können.

MfG Cbothe

Hi,
aus dem API-Guide (http://www.allapi.net/):

'in a form
Private Sub Form\_Load()
 'KPD-Team 2000
 'URL: http://www.allapi.net/
 'E-Mail: [email protected]
 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

Dort gibt es auch andere Varianten, einen Thread zu finden (und zu beenden), schau mal nach.

Gruß

J.

[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]