检测电脑的关机程序 [英] Detecting the Turnoff procedure of the PC

查看:90
本文介绍了检测电脑的关机程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想要一个程序来计算计算机的工作时间.因此,我需要在表单上显示持续时间,并推迟关闭过程,直到用户单击表单上提供的按钮.所以我有两个问题,我要问这个问题中的第一个问题,而将第二个问题留给嵌套问题.我要在此问题中解决的问题是如何检测关闭程序以显示显示工作持续时间的表格.你能让我怎样完成它吗?

非常感谢您

解决方案

看看System.Environment类.
更具体地讲,Environment.TickCountEnvironment.HasShutdownStarted


一种实现方法是在计算机启动时启动Windows服务,并在某个地方的数据库中记录时间.

Hello,

I want to have a program calculating how long the computer was working. So I need to show the duration on a form and postpone the turnoff procedure until the user click a button provided on the form. So I have two problems that I am asking the first one in this question and leave the second one for the nest question. The problem I look for to tackle in this question is how to detect turnoff procedure to show the form displaying the working time duration. Could you please let me how I can get it done?

Thank you very much

解决方案

Look at the System.Environment class.
More specifically Environment.TickCount and Environment.HasShutdownStarted


One way to do this would be to have a windows service startup when your machine starts up and log the time in a database somewhere.


这篇关于检测电脑的关机程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆