Modül :
- Option Explicit
- Declare Function CreateToolhelpSnapshot Lib "kernel32" _
- Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVallProcessID As Long) As Long
- Declare Function ProcessFirst Lib "kernel32" _
- Alias "Process32First" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
- Declare Function ProcessNext Lib "kernel32" _
- Alias "Process32Next" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
- Declare Sub CloseHandle Lib "kernel32" (ByVal hPass As Long)
- Public 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
Form :
- Option Explicit
- Function process(Program As String) As String
- Dim txt As String
- Dim hSnapShot As Long
- Dim uProceso As PROCESSENTRY32
- Dim resul As Long
- hSnapShot = CreateToolhelpSnapshot(2&, 0&)
- If hSnapShot <> 0 Then
- uProceso.dwSize = Len(uProceso)
- resul = ProcessFirst(hSnapShot, uProceso)
- Do While resul
- If Program = Left$(uProceso.szExeFile, InStr(uProceso.szExeFile, Chr$(0)) - 1) Then
- MsgBox "açık"
- End If
- resul = ProcessNext(hSnapShot, uProceso)
- Loop
- Call CloseHandle(hSnapShot)
- End If
- End Function
0 yorum:
Yorum Gönder