Link to home
Start Free TrialLog in
Avatar of blevan
blevan

asked on

Running Processes Info

I need to check the list of Running Processes every so often and if multiple outlook processes exist, I need to clear them.

Here is a snipplet of the code I am using:

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

The only data I get returned id szExeFile (ProcessName)

How can I get the UniqueID for the thread or process so that I can terminate that process?
ASKER CERTIFIED SOLUTION
Avatar of mukvij
mukvij

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of blevan
blevan

ASKER

This is required because I am Shelling Outlook to get a unique ID then when I close Outlook, I AppActivate Unique ID and SendKeys Alt-F4 until the AppActivate causes an error condition (this way I close and dialog boxes which may have popped-up i.e. New Mail Notification.). Outlook is disappearing from the Task List but on occasion it remains in the running processes list, this builds-up until the system is finally choked (no avail resources). I can get a list of the processes running but I need a way to address them to close them or end their task.

I will try mukvij's suggestion and see if I can address the processes using find window although I though the program has to show in the Task list (Alt-Tab or Taskbar) not the Running Processes List (Crtl-Alt-Delete). If it works, I'll accept mukvij's solution.