如果在C#或ASP中关闭Monitor,我们可以为关闭系统制作Windows服务或Web服务 [英] Can We Make windows service or web service for shutdown system if power off for Monitor in C# or ASP
本文介绍了如果在C#或ASP中关闭Monitor,我们可以为关闭系统制作Windows服务或Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些方法可以让Windows获得如果Monitor关闭电源
i got some method for Windows to get if Monitor is power off
Boolean isRunningOnBattery =
(System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus ==
PowerLineStatus.Offline);
现在我想从gettting false获得一个weservice上面的代码并运行这个.bat文件,下面给出了代码
shutdwon -s -t 00
然后用shutdown.bat保存
请帮帮我
问候
zaid
Now I want a weservice after gettting false from above code and get run this .bat file which code is given below
shutdwon -s -t 00
then save with shutdown.bat
please help me
Regards
zaid
推荐答案
您发布的方法不会返回显示器电源状态。
查看<的文档a href =http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.powerstatus%28v=vs.110%29.aspx> SystemInformation.PowerStatus.PowerLineStatus 物业。
如果您发布的代码在tar上运行搞PC,你为什么需要网络服务?
你为什么要运行批处理文件? ...你能否使用:
Hi,
the method you posted does not return the monitor power status.
Have a look at the documentation for SystemInformation.PowerStatus.PowerLineStatus Property.
If the code you posted is running on the target PC, why do you need a webservice?
Why are you wanting to run a batch file? ... can you not use:
Process.Start("shutdown","/s /t 0");
希望有所帮助。
Hope it helps.
我需要监控我的笔记本电脑制作的连击是生活的好,理由是学习新的东西
第二批文件将帮助我在系统电量非常低时关闭系统而不是在我的房间,我正在下载和所有..
I need to monitor my lap top batter for making is life good and reason is to learn new thing
second batch file will help me to shutdown the system when i got the system is on very low battery and and not in my room and i m doing downloading and all..
这篇关于如果在C#或ASP中关闭Monitor,我们可以为关闭系统制作Windows服务或Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文