[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Detect and log all programs opening and closing

Posted on 1999-12-14
5
Medium Priority
?
197 Views
Last Modified: 2010-05-02
I need to know how to detect if a program is opened.  Not a specific program, but any program at all.  I want to log when it was opened, and when it was closed.  Thanks.
0
Comment
Question by:TAF2000
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:mcrider
ID: 2282347
Check out this microsoft Article:

HOWTO: List Running Processes
http://support.microsoft.com/support/kb/articles/Q187/9/13.ASP?LNG=ENG&SA=MSDN 
 

Cheers!
0
 

Author Comment

by:TAF2000
ID: 2284617
I knew how to do that, but I want to be able to know when programs are opened and closed, not currently running.  I have not been able to think of a way to record that.
0
 

Accepted Solution

by:
DanielCar earned 100 total points
ID: 2293068
Good Morning TAF!

Using mcrider's solution is the key to solving the problem.
When you have a list of all the program running, all you have to do is check whether a program has been added to the list. If so, note the time: you now have the time a program was started. If one has been removed from the list, it has been closed. Note the time. You now have a list of all program started, closed and the time at which these events took place.

Daniel       :-)
0
 

Author Comment

by:TAF2000
ID: 2293448
How would you check to see if the something is already in a list, and how would you check to see if something has been removed?  I have not worked with lists much.

Thanks
0
 

Expert Comment

by:DanielCar
ID: 2294126
Hello TAF!

Looking at the code that mcrider's link points to, there is a list on the form that items get added to. Instead of adding the name of these processes to that list, I would create an array ion memory, and add the processes to the first column of that the first time. Then, when going through the processes the second time, I would first try to see if the item is already in the array. If it is I just store it in the second column. If it isn't in the array, I log that as a start time. When I reached the last process, I would then check if there are any lines in the array that have an element in the first column and not in the second, I'd mark that as the end time.
The nI would clear the first column, and move the elements from the second column to the first, and wait a while before doing it again...

I think that's about as far as I can explain without actually writing the code.

What are you trying to achieve exactly?

Daniel        :-)
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

612 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