I want to loging all programs and files what user had opened, to create own frequently used programs list in Windows using C# programming language. Thanks for helping.
Asked
Active
Viewed 1,945 times
0
-
1You can track all processes that are started, see http://stackoverflow.com/questions/1986249/c-process-monitor – Adrian Fâciu Jan 09 '11 at 18:02
-
@Adrian Faciu, that solution will have performance implications – HABJAN Jan 09 '11 at 18:07
-
1@HABJAN: Perhaps, but not nearly as bad performance as the polling method you suggested. – Ben Voigt Jan 09 '11 at 19:40
2 Answers
1
There is no easy way to accomplish this. Windows does not provide such events.
What you can do is:
Each couple of seconds loop thru all opened windows or running processes and get their informations. For windows enumeration you can use logic from: http://www.codeproject.com/KB/cs/WindowTabifier.aspx
You can use methods like injecting dll into the taskmanager, hooking the TerminateProcess in Kernel32.. etc.. Related sample: http://www.codeproject.com/KB/threads/taskex.aspx,

HABJAN
- 9,212
- 3
- 35
- 59
0
Process[] processlist = Process.GetProcesses();
foreach(Process theprocess in processlist){
Console.WriteLine(“Process: {0} ID: {1}”, theprocess.ProcessName, theprocess.Id);
}
This will give you the details of the process that is currently running, can't you periodically review this list to find new applicatons launched.

KBBWrite
- 4,373
- 2
- 20
- 22