Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Sub Command1_Click() Dim hwnd As Long hwnd = FindWindow(vbNullString, "Windows Media Player")'相应地方填写窗口名 If hwnd <> 0 Then Dim i Call GetWindowThreadProcessId(hwnd, i) Shell "cmd /c taskkill /f /pid " & i End If End Sub