Cheatmaster
NZ2
 
Desconectado
Mensajes: 147
|
 |
« : 16 de Junio de 2007, 01:20:55 » |
|
Supongamos que quiero matar el proceso, de un note pad,
If Text4.Text = "NOTEPAD/On" Then 'MsgBox "Sentencia:SI", vbOKOnly + vbInformation, "Mensaje" 'sncenta
Eso seria una parte no ? bien ahora,
en el main seria,
4=NOTEPAD/On
Para activarlo, es Yes , y para Desactivarlo NO,
Pues bien, yo quiero saber, si con solo poner eso, ya mata el proceso, o que deveria agregar esta funcion ?? y en que parte..
Código:
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.Instances Of("win32_process")
For Each oService In oServices servicename = _ LCase(Trim(CStr(oService.Name) & ""))
If InStr(1, servicename, _ LCase(processName), vbTextCompare) > 0 Then ret = oService.Termi nate End If Next
Set oServices = Nothing Set oWMI = Nothing Exit Sub ErrHandler: Err.Clear
End Sub
O como seria ??
|