Checking whether the application in running or which tab is active
<p>I am new to programming. I am trying to develop an application in which i want to find out the time the user has spent with the application.
Say the user works with a number of processes(opens a word file,opens paint, opens a browser and browses,opens photoshop etc) These processes come as different tabs in the taskbar. The user will keep switching the tabs. I want to find out the time spent on each day for photoshop.The user has to enter the login time and logout time in date time format, so i will be able to get the date details. I am planning to use the timer. When the photoshop tab is active the timer should start and when he switches the tab, the timer should stop and the value is stored in a variable. Each time the variable value is updated. But how to detect whether  photoshop tab is active tab or how to detect whether the user is using the photoshop.Which event to use to find the tab switch.</p>
