Setting ScreenSaver

  • Thread starter Thread starter Christopher Burr
  • Start date Start date
C

Christopher Burr

I'm trying to set the user's screensaver in the .NET world...

In Win32 I could use a combination of setting the screen saver name via the
registry and then setting the time and active status using
SystemParametersInfo. And the system would use the new settings.

Now that I'm trying to do it in .NET, I found that SystemParametersInfo does
not exist. I also found I can detect when the screensaver settings have
been changed, but what I cannot find out is how to cause the system to know
that the screensaver settings have changed...

Anyone have any ideas?
 
You still can use those features through P/Invoke.

Add namespace System.Runtime.InteropServices in your code and then declare
[DllImport("user32", CharSet=CharSet.Auto)]
unsafe public static extern short SystemParametersInfo (int uiAction, int
uiParam, int* pvParam, int fWinIni);


HTH
Shishir Kumar Mishra
Agni Software (P) Ltd.
www.agnisoft.com
 
Yea, was just hoping that I could avoid going to unmanaged code.

--
Chris Burr
(e-mail address removed)


Shishir Kumar Mishra said:
You still can use those features through P/Invoke.

Add namespace System.Runtime.InteropServices in your code and then declare
[DllImport("user32", CharSet=CharSet.Auto)]
unsafe public static extern short SystemParametersInfo (int uiAction, int
uiParam, int* pvParam, int fWinIni);


HTH
Shishir Kumar Mishra
Agni Software (P) Ltd.
www.agnisoft.com

Christopher Burr said:
I'm trying to set the user's screensaver in the .NET world...

In Win32 I could use a combination of setting the screen saver name via the
registry and then setting the time and active status using
SystemParametersInfo. And the system would use the new settings.

Now that I'm trying to do it in .NET, I found that SystemParametersInfo does
not exist. I also found I can detect when the screensaver settings have
been changed, but what I cannot find out is how to cause the system to know
that the screensaver settings have changed...

Anyone have any ideas?
 
Only problem then is that the effects don't take place until the next login
=(

--
Chris Burr
(e-mail address removed)


 
Back
Top