0

So I have a bit of code I'm working with that's supposed to disable the screensaver timeout

    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    private static extern bool SystemParametersInfo(
        int uAction, int uParam, ref int lpvParam,
        int flags);

    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    private static extern bool SystemParametersInfo(
        int uAction, int uParam, ref bool lpvParam,
        int flags);

SystemParametersInfo(15, Value, ref nullVar, 2);

I also have a function to GET the current screensaver timeout value,

SystemParametersInfo(14, 0, ref value, 0);

When I'm attemtping to set this value to 0 for the timeout, once I get the current value, it's returning a value of 600.

It doesn't appear as if the value I'm setting is actually being set.

Does anyone know what might cause this? by the way, I'm on a Windows 7 x64 machine and I'm on a domain which is setting this policy (i believe).

Thanks all!

Patrick Quirk
  • 23,334
  • 2
  • 57
  • 88
Clu
  • 339
  • 3
  • 8
  • 18

1 Answers1

0

try to setting it to -1 instead of 0, maybe it works...