کد زیر این کارو واست انجام می ده. فقط توجه داشته باش که NT به بالا جواب نمی ده.
Private Const TH32CS_SNAPPROCESS = &H2
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * 260
End Type
Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32.dll" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32.dll" (ByVal hSnapshot As Long, Uprocess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32.dll" (ByVal hSnapshot As Long, Uprocess As PROCESSENTRY32) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
----------------------------------------------------------------------------------------------------
Private Sub Remove_Program_From_TaskMgr()
Dim Info As PROCESSENTRY32
Dim RetList As Long, FirstEXEProg As Long, Retval As Long
Dim EXEName As String
RetList = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
Info.dwSize = Len(Info)
FirstEXEProg = Process32First(RetList, Info)
If RetList <> -1 Then
While FirstEXEProg <> 0
With Info
EXEName = Left(.szExeFile, InStr(.szExeFile, Chr(0)) - 1)
If InStr(LCase(EXEName), "Program Name") <> 0 Then
On Error GoTo EXT:
RegisterServiceProcess .th32ProcessID, 1
EXT:
End If
.dwSize = Len(Info)
FirstEXEProg = Process32Next(RetList, Info)
End With
Wend
End If
CloseHandle RetList
End Sub