Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
PIEBALDconsult 22-Dec-14 13:33pm    
Why? I think the system knows best; don't mess with it.
Mahdi Nejadsahebi 22-Dec-14 13:37pm    
I'm working on a project that i have to do this with code(manually).
can you give any reference?

1 solution

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
 
Share this answer
 
v3
Comments
Maciej Los 22-Dec-14 14:08pm    
+5
Sergey Alexandrovich Kryukov 22-Dec-14 14:32pm    
Thank you, Maciej.
—SA
Mahdi Nejadsahebi 22-Dec-14 14:08pm    
so Thanks for your guide.
your explain completely and this is the what we(beginners) need that.
i got the path of the work and it's too soon for me.

thanks alot
Sergey Alexandrovich Kryukov 22-Dec-14 14:33pm    
You are very welcome.
Good luck, call again.
—SA
Afzaal Ahmad Zeeshan 22-Dec-14 14:11pm    
I have voted your answer for a 5, because it is such a great answer that it even helped me out to understand a few concepts about these things too.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900