开发者

Windows 7 and SPI_GETSCREENSAVERSECURE

I'm having a problem with the SystemParametersInfo API in C#. I have no problem getting the screensaver timeout, but when I try to get the state of the "On resume display logon screen" checkbox I always get false.

[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
private static extern bool SystemParam开发者_运维问答etersInfo(uint uiAction, uint uiParam, ref uint pvParam, uint fWinIni);

public void Test() {
    uint result = 0;
    SystemParametersInfo(76, 0, ref result, 0);
}

The result will always be 0, however I do see the registry value changing from 1 to 0 (but I can't use the registry value, because setting it via the registry would cause my new setting to be processed only after logoff).

You can use the value 14 to retrieve the screensaver timeout value.

I have already tried to rewrite the external function from a ref uint to a ref bool, but that doesn't matter.

I'm using Windows 7 x64. MSDN is my source for the parameter information:

http://msdn.microsoft.com/en-us/library/ms724947(VS.85).asp

Does anyone have a clue?


SPI_GETSCREENSAVESECURE is 0x76, not 76.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜