Solved

Running Processes Info

Posted on 1999-01-27
2
157 Views
Last Modified: 2012-05-04
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?
0
Comment
Question by:blevan
2 Comments
 
LVL 1

Accepted Solution

by:
mukvij earned 100 total points
Comment Utility
1. If you know caption of window, You can use FindWindow API to return you with Process Id. Then You can you this handle in OpenProcess to get actual process handle.

2. If you Shelled Outlook use Shell as a function to return you peocess Id.



0
 

Author Comment

by:blevan
Comment Utility
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.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now