2011-06-21 7 views
0

"ReadProcessMemory" APIを使用して、マシンの実行中のすべてのプロセスをループし、文字列の配列をスキャンし、1つまたは複数のメモリがメモリに格納されている場合は真偽値を返します。プロセス - VB6を使用して?Loopすべてのプロセスメモリ

例:

Strings() = {"@[email protected]", "@[email protected]", "$TRING"} 
Loop # Processes 
    If InStr(ProcessMemory(#), Strings) Then 
     MsgBox(Process(#) & " Contains one of the strings!") 
    End If 
Loop 

答えて

1

私は知らないが、私は私のプログラムでは、どのように

Public Sub KillProcess(ByVal processName As String) 

On Error GoTo ErrHandler 

Dim oWMI 
Dim ret 
Dim sService 
Dim oWMIServices 
Dim oWMIService 
Dim oServices 
Dim oService 
Dim servicename 

Set oWMI = GetObject("winmgmts:") 
Set oServices = oWMI.InstancesOf("win32_process") 

For Each oService In oServices 

    servicename = LCase$(Trim$(CStr(oService.Name) & "")) 

    If InStr(1, servicename, LCase(processName), vbTextCompare) > 0 Then 
     ret = oService.Terminate 
    End If 

Next 

If Not oServices Is Nothing Then Set oServices = Nothing 
If Not oWMI Is Nothing Then Set oWMI = Nothing 


ErrHandler: 
    Err.Clear 

End Sub 
+0

無効にWMIサービスを残すためにもう一つの良い理由

何かをWMIを使用。 – Bob77

関連する問題