joe
joe

Reputation: 8634

How to get user lock / screensaver delay?

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?

Upvotes: 0

Views: 946

Answers (2)

David Heffernan
David Heffernan

Reputation: 612804

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

Upvotes: 2

dutzu
dutzu

Reputation: 3910

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.

Upvotes: 0

Related Questions