Solved

Running Processes Info

Posted on 1999-01-27
2
170 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
ID: 1470942
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
ID: 1470943
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

749 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