找不到任何合适的编码来创建日志来保存系统电源开和关条目. [英] Could not find any proper coding to create a log to hold the system power on and off entry.

查看:86
本文介绍了找不到任何合适的编码来创建日志来保存系统电源开和关条目.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在互联网上冲浪时,我发现了很多解释Onstart()和OnStop方法的示例,但它们并不能解决我保存这两个条目并为此保留单独日志的目的.转发以将其日志保存为我的PC上的隐藏文件,该文件每天都会更新.

As i surfed through the internet i found lot of examples having explained Onstart() & OnStop method but they do not solve my purpose of saving particularly those two entry and keep a seprate log for that.At the same time i am looking forward to save that log on my pc as a hidden file that get updated daily

推荐答案

我认为您可以使用Windows服务.您可以在服务启动时记录日志,并在服务停止时记录日志.然后将服务配置为在系统启动时启动.这样,当您的系统启动时,您的服务将记录并记录时间.系统即将停止时,您的服务也会停止,然后它也会记录时间.

普通应用程序有点困难.
I think you can have windows service. you can log when the service starts and lop when service stops. then configure the service to launch on system start. that way when your system starts your service will to and log the time. when the system is about to stop your service will stop and then it log the time too.

little difficult to do with a normal application.


这篇关于找不到任何合适的编码来创建日志来保存系统电源开和关条目.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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