如何使用代码在运行时禁用临时硬盘? [英] How Can I Disable Temporarly Hard Disk In Running Time With Code?

查看:95
本文介绍了如何使用代码在运行时禁用临时硬盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以上帝的名义

玩得开心





你知道什么时候系统是运行和用户什么都不做,硬盘将关闭大约10分钟。



实际上我需要代码关闭硬盘时

系统开启(电源开启),代码如Power Option。

实际上我需要驱动程序编写代码。



i与之合作API函数,但我不知道我应该使用什么函数。

你可以帮我吗?

提前感谢

In the name of god
have a good time


you know when the system is running and user does nothing, hard disk will turn off about 10 minutes.

in fact i need the code that turns off the hard when
the system is on(Power is on) with code like Power Option.
actually i need the Driver Writing code.

i worked with API functions but i don't know what function exactly should i use.
can you help me please?
thanks in advance

推荐答案

Mahdi Nejadsahbei写道:
Mahdi Nejadsahbei wrote:



您知道系统何时运行且用户什么都不做,硬盘会关闭大约10分钟


you know when the system is running and user does nothing, hard disk will turn off about 10 minutes

不,我不知道。实际上,这不是真的。仅当以这种方式配置OS时才会发生这种情况。这是系统用户,而不是你。你的应用程序行为不应该依赖于它。逻辑上。

No, I don't know about it. Actually, this is not true. It happens only if the OS is configured this way. It's up the the system user, not you. Your application behavior should not depend on that, logically.

Mahdi Nejadsahbei写道:
Mahdi Nejadsahbei wrote:



实际上我需要驱动程序编写代码


actually i need the Driver Writing code

你可能意味着什么?如果您想开发自己的驱动程序,则需要获得WDK并学习驱动程序开发。请参阅:

http://en.wikipedia.org/wiki/Windows_Driver_Kit [< a href =http://en.wikipedia.org/wiki/Windows_Driver_Kittarget =_ blanktitle =New Window> ^ ],

http://msdn.microsoft.com/en-US/windows/hardware/gg454513 [ ^ ]。



请注意,这并不像你想象的那么容易。需要更好地理解CPU架构,包括内核模式和保护环;它意味着对Windows体系结构的了解远远超过应用程序开发人员的知识。与此同时,您想要搞乱系统省电功能(这就是它,不再是它)以及它的预期价值是非常值得怀疑的。



相反,您可以使用Windows Instrumentation(WMI)来控制电源选项。但即使这个想法也值得怀疑。你为什么要搞乱这些电源选项?您应该更好地假设您的用户更了解如何使用它。不过,你可能需要它,所以请看:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa373163%28v=vs.85%29.aspx [ ^ ]。



要了解如何在.NET中使用WMI,可以从这里开始:http://msdn.microsoft.com/en-us/library/ms257340%28VS.80%29.aspx [ ^ ]。



另请参阅: http://en.wikipedia.org/wiki/Windows_Management_Instrumentation [< a href =http://en.wikipedia.org/wiki/Windows_Management_Instrumentationtarget =_ blanktitle =New Window> ^ ]。



-SA

What would you possibly mean by that? If you want to get to developing of your own drivers, you would need to get WDK and learn driver development. Please see:
http://en.wikipedia.org/wiki/Windows_Driver_Kit[^],
http://msdn.microsoft.com/en-US/windows/hardware/gg454513[^].

Note that it's no that easy as you may think. It will take better understanding the CPU architecture, including kernel mode and protection rings; and it means a lot more knowledge on Windows architecture than the knowledge of an application developer. At the same time, your idea of messing up with the system power saving features (this is what it is, no more) and its prospective values are quite questionable.

Instead, you could use Windows Instrumentation (WMI) to control the power options. But even this idea is questionable. Why would you want to mess with those power options? You should better assume that your users know better what to do with it. Nevertheless, you might need it, so please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa373163%28v=vs.85%29.aspx[^].

To learn how to use WMI with .NET, you can start here: http://msdn.microsoft.com/en-us/library/ms257340%28VS.80%29.aspx[^].

See also: http://en.wikipedia.org/wiki/Windows_Management_Instrumentation[^].

—SA


这篇关于如何使用代码在运行时禁用临时硬盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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