Reputation: 1918
Is there a way to permanently change Windows 10 display setting using C#
code.
Changes that I have to do are as follows:
- sleep: Never 2. screenSaver: disable 3. HardDisk(Sleep) : Never
I have a media player setup, and once this player is installed, the setting should be reflected. Don't want temporary changes like while the program is running, it will prevent sleep mode or something like that.
I am using .Net 4.5
with visual studio 2015
Upvotes: 1
Views: 4192
Reputation: 1918
Instead of using registry i found a solution to solve these issue using command prompt and the command are:
require Administrative permission
To disable sleep run using cmd
powercfg -x -standby-timeout-ac 0
For HardDisk (Sleep->Never)
powercfg -Change -disk-timeout-ac 0
For monitor
powercfg -Change -monitor-timeout-ac 0
Edit:
For how to execute cmd
command in C# see Here
Upvotes: 5