2009-11-29 73 views
0

我遇到了C#中的SystemParametersInfo API問題。我沒有問題得到屏幕保護程序超時,但是當我嘗試獲取「在恢復顯示登錄屏幕上」複選框的狀態時,我始終得到虛假Windows 7和SPI_GETSCREENSAVENSECURE

[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")] 
private static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref uint pvParam, uint fWinIni); 

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

結果將始終爲0,但是我看到的註冊表值從1更改爲0(但我不能使用註冊表值,因爲通過註冊表設置會引起我的新的設置是僅在註銷後處理)。

您可以使用值14來檢索屏幕保護程序超時值。

我已經嘗試從裁判UINT重寫外部函數的裁判布爾,但這並不重要。

我正在使用Windows 7 x64。 MSDN是我的參數信息來源:
http://msdn.microsoft.com/en-us/library/ms724947(VS.85).asp

有沒有人有線索?

回答

2

SPI_GETSCREENSAVESECURE是0x76,不是76

+0

唉唉和爲此118,whoooops!日Thnx! – Zyphrax 2009-11-29 14:39:34