Mahdi Nejadsahbei wrote:
you know when the system is running and user does nothing, hard disk will turn off about 10 minutes
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 wrote:
actually i need the Driver Writing code
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