0

How do I get the user's setting for screensaver / machine lock time?

Is there a function in C#?
If not, what is the WIN API function for this?

joe
  • 8,344
  • 9
  • 54
  • 80

2 Answers2

1

The screen saver timeout is obtained by calling SystemParametersInfo with the action SPI_GETSCREENSAVETIMEOUT.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
0

Registry key - HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop look at the value of ScreenSaveTimeOut

Keep in mind your application will have to run with elevated rights in order to access the registry.

dutzu
  • 3,883
  • 13
  • 19