Determine which executables are running with WinNT 4.0 ?? 
Author Message
 Determine which executables are running with WinNT 4.0 ??

Hi There,

does anybody know how to determine which executables are running with WinNT
4.0 ?? The following code works only on Win9x and 2000.

I want to find out if  app.exe is running by checking "app.exe"

Thanks

' - - - - - - - - - - - - -MODULE - -- - - -
Option Explicit

Public Const TH32CS_SNAPPROCESS As Long = 2&
Public Const MAX_PATH As Integer = 260

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 * MAX_PATH
End Type
Public Declare Function CreateToolhelpSnapshot Lib "Kernel32"  _
Alias "CreateToolhelp32Snapshot" _
(ByVal lFlags As Long, ByVal lProcessID As Long) As Long

Public Declare Function ProcessFirst Lib "Kernel32" _
Alias "Process32First" _
(ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long

Public Declare Function ProcessNext Lib "Kernel32" _
Alias "Process32Next" _
(ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long

Public Declare Sub CloseHandle Lib "Kernel32" _
(ByVal hPass As Long)

' -  - - - - - - ON MAIN FORM - - - - - - - - - - - - - - -
'Create a list box with a close and running tasks button
'Code for "running tasks" button

Private Sub Command1_Click()
Dim hSnapShot As Long
Dim uProcess As PROCESSENTRY32
Dim r As Long
hSnapShot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
If hSnapShot = 0 Then
Exit Sub
End If
uProcess.dwSize = Len(uProcess)
r = ProcessFirst(hSnapShot, uProcess)
Do While r
List1.AddItem uProcess.szExeFile
r = ProcessNext(hSnapShot, uProcess)
Loop
Call CloseHandle(hSnapShot)
End Sub



Fri, 31 May 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VB4-32 : Determining if a specific executable is running

2. WINAPI for VB 4.0 16Bit to read WinNT 4.0 registry

3. Determining if an application is running (VB 4.0 32)

4. Geting App executable from proces on WinNT.

5. ActiveX Document Executable, What Am I Missing?

6. PLS HELP: NEWBIE How to determine if WinNT or Windows95

7. howto determine user/client name with winnt/vb

8. howto determine user/client name with winnt/vb

9. Determining user permissions for a WinNT shared directory

10. Need to determine executable file version

11. Determine file type and executable version?

12. determining if a file is an executable

 

 
Powered by phpBB® Forum Software