开发者

how to catch the event when the particular application process is being suspended using task manager?

开发者 https://www.devze.com 2023-01-05 17:21 出处:网络
I am developing a simple application where in we have predefined quotas on usage for each user on the system..

I am developing a simple application where in we have predefined quotas on usage for each user on the system.. and if the quota is up..the system should logoff of the user account.. t开发者_运维技巧his will happen if the application is allowed to run.. but if the user is closing the application on his own ..the app should automaticaly logoff the account..

i did exactly that in writing forced logoff code in form-closing event.. but if we are closing the app/process using the taskmanager.. the form closing event is not being called. and so the user is able to continue even if his quota of time is up.. can anybody helpme out with this..


This is nice question. Maybe you can make an applicaton to watch task manager and user status. I am not sure about that could help you but I gonna write

for ex

Process[] myApp = Process.GetProcesses("My Application");

        if (myApp.Length == 0)
        {
            // App closed, and check the user status
            // If user is still up, make it logoff,
            // Also you can track processes with ProcessId too GetProcessesById(5415)
        }
        else
        {
            // App is running, there is no problem
        }
0

精彩评论

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