Solved

Running Processes Info

Posted on 1999-01-27
2
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

617 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