开发者

Close the process/program automatically in 10 min using C#/VC++?

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 automatic开发者_开发问答ally close on 15 th minute...


There are two ways I think you may acheive this
1. Manual polling of applications started using EnumProcessModules and terminate them using TerminateProcess and
2. 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_DLLs in the following registry key HKEY_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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜