I have one Windows Service/Application running silently on the PC, when user starts any program , i need to count the time and close it down (program) in 15 Minutes. Even when the user close down the particular program ( say winword.exe) with in 15 min, and reopen it… the program should automatically close on 15 th minute…
I have one Windows Service/Application running silently on the PC, when user starts any
Share
There are two ways I think you may acheive this
1. Manual polling of applications started using
EnumProcessModulesand terminate them usingTerminateProcessand2. Using Dll injection using App_Init registry
I’ll talk a little more about number 2.
When you place your dll name in the following registry value in
AppInit_DLLsin the following registry keyHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows, you can make the dll load with almost every application that launches. You could write a 15 min timer in the dllmain of your injected dll and do exitprocess() when it elapses, eventually taking down the entire process.