Search code examples
c++adobe-readeruser-inactivity

Auto close Adobe Reader after inactivity C++


I am trying to write a small program to keep track of user inactivity and after about 30 minutes kill all running adobe reader applications on a Windows 7 computer. The paychex software we use doesn't allow more than one pay stub open at once so if they are not closed and the next employee comes to use the computer they can't view their pay stub.

Maybe this is easier using a batch file or scripting but I know C++ fairly well so that is what I started with.


Solution

  • Detecting that Windows is idle is the hardest part, but luckily you have Windows 7 and can use IIdleTrigger.

    After that, it's just a matter of sending a window close message to Adobe Reader. Look for the caption which includes the pay stub name so you close the right instance.