VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



WinLurk allows you to see all the current processes that your operative system is runing giving you

by John Villa (2 Submissions)
Category: Windows System Services
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Thu 19th July 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

WinLurk allows you to see all the current processes that your operative system is runing giving you the possibility of detecting possible

API Declarations


'put 3 command buttons: bActualizar, bMatar and bRecuperar
'into the form
'TELL ME HOW DID U LIKE IT Ok

'Thanks Waty Thierry

Rate WinLurk allows you to see all the current processes that your operative system is runing giving you




'puede usar libremente este codigo fuente en sus aplicaciones,
'agradezco sus creditos en sus programas como en el acerca de o algo por
'el estilo, asi como agradezco tambien que hagan que este codigo sea
'enviado a otras personas interesadas

'U can use this code in your app's without any restrictions,
'i'd thank if you include  me in your about box or the like.
'Please send this code to any person interested

'                                                       =8-) John J. Villa
'                                                       visualbasic@ ingenieros.com

Dim ancho As Integer 'Actual Width of the form, used to manage the width of the controls - Ancho actual de la forma, usada para controlar el ancho de los controles

Private Const MAX_PATH& = 260
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 * MAX_PATH
End Type

Private Declare Function TerminateProcess Lib "kernel32" (ByVal ApphProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal blnheritHandle As Long, ByVal dwAppProcessId As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, lProcessID As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Dim X(100), Y(100), Z(100) As Integer
Dim tmpX(100), tmpY(100), tmpZ(100) As Integer
Dim K As Integer
Dim Zoom As Integer
Dim Speed As Integer

Public Function KillApp(myName As String) As Boolean 'funcion que recibe la cadena de la aplicacion a aniquilar - function that receives the name of the application that is going to be killed
Const PROCESS_ALL_ACCESS = 0
Dim uProcess As PROCESSENTRY32
Dim rProcessFound As Long
Dim hSnapshot As Long
Dim szExename As String
Dim exitCode As Long
Dim myProcess As Long
Dim AppKill As Boolean
Dim appCount As Integer
Dim i As Integer
On Local Error GoTo Finish
appCount = 0
Const TH32CS_SNAPPROCESS As Long = 2&

uProcess.dwSize = Len(uProcess)
hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
rProcessFound = ProcessFirst(hSnapshot, uProcess)
List1.Clear
Do While rProcessFound
    i = InStr(1, uProcess.szexeFile, Chr(0))
    szExename = LCase$(Left$(uProcess.szexeFile, i - 1))
    List1.AddItem (szExename)
    If Right$(szExename, Len(myName)) = LCase$(myName) Then
        KillApp = True
        appCount = appCount + 1
        myProcess = OpenProcess(PROCESS_ALL_ACCESS, False, uProcess.th32ProcessID)
        AppKill = TerminateProcess(myProcess, exitCode)
        Call CloseHandle(myProcess)
    End If
    rProcessFound = ProcessNext(hSnapshot, uProcess)
Loop
Call CloseHandle(hSnapshot)
Finish:
End Function


Private Sub Form_Load()
ancho = Me.Width
KillApp ("none")
Text1.Text = ""
End Sub

Private Sub Form_Resize()
Dim i As Integer
For i = 0 To Controls.Count - 1
    If Not (TypeOf Controls(i) Is Menu) Then
        Controls(i).Width = Controls(i).Width + (Me.Width - ancho)
    End If
Next i
ancho = Me.Width
End Sub

Private Sub List1_Click()
Text1.Text = List1.List(List1.ListIndex)
If Text1.Text <> "" Then bMatar.ToolTipText = "Matar Aplicación " & Text1.Text
End Sub

Private Sub List2_Click()
Text2.Text = List2.List(List2.ListIndex)
If Text2.Text <> "" Then bRecuperar.ToolTipText = "Recuperar Aplicación " & Text2.Text
End Sub


Private Sub bActualizar_Click()
Text1.Text = ""
KillApp ("none")
End Sub

Private Sub bMatar_Click()
If Text1.Text <> "" Then
    KillApp (Text1.Text)
    MsgBox "La aplicación " & Text1.Text & " ha sido aniquilada", vbExclamation
    List2.AddItem (Text1.Text)
    Text1.Text = ""
    KillApp ("none")
    bMatar.ToolTipText = "Matar Aplicación "
Else
    MsgBox "Debe elegir una aplicación para efectuar la operación", vbExclamation
    KillApp ("none")
End If
End Sub

Private Sub bRecuperar_Click()
If Text2.Text <> "" Then
    Shell (Text2.Text)
    MsgBox "La aplicación " & Text2.Text & " ha sido recuperada", vbExclamation
    Text2.Text = ""
    List2.RemoveItem (List2.ListIndex)
    Call bActualizar_Click
    bRecuperar.ToolTipText = "Recuperar Aplicación "
Else
    MsgBox "Debe elegir una aplicación para efectuar la operación", vbExclamation
End If
End Sub


Download this snippet    Add to My Saved Code

WinLurk allows you to see all the current processes that your operative system is runing giving you Comments

No comments have been posted about WinLurk allows you to see all the current processes that your operative system is runing giving you. Why not be the first to post a comment about WinLurk allows you to see all the current processes that your operative system is runing giving you.

Post your comment

Subject:
Message:
0/1000 characters