Detect and log all programs opening and closing

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.
TAF2000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
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
TAF2000Author Commented:
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
DanielCarCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TAF2000Author Commented:
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
DanielCarCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.