locked
Off Topic: Batch script to emulate "Apply" button in desk.cpl RRS feed

  • General discussion

  • Hey folks,

    I've got a script that makes some changes to the registry, most notably screensaver settings.  However, I need these changes to be picked up without forcing the user to log off or restart.  I know it's possible, because you can select "Apply" from the Display Properties widget and the changes are picked up instantly.  I thought the following might do the trick by refreshing the HKCU hive:

    %SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters

    ...but, no such luck.  I'm pretty sure that with some crafty calls to desk.cpl or user32.dll, I can get explorer to instantly recognize the changes I've made, but I'm not quite sure what those calls would look like.  I've run through a non-trivial list of possibilities, but no winners yet.  I've also tried killing explorer with tskill, but it doesn't seem to pick up the changes.

    So.... I guess it all boils down to what scripting language and what calls with said language need to be made to emulate the effects of the "Apply" button in desk.cpl?  I'm open to whatever works.

    Thanks,
    Ryan
    Thursday, March 6, 2008 5:35 PM

All replies

  • Nevermind - I wrote an executable that changes the screensaver timeout, password protects it, and locks it from editing.  In the end, I never did find a way to do this with rundll32/desk.cpl.  I suppose it requires someone with a bit more knowledge of the underlying libraries and their methods.

    Thanks anyways,
    Ryan
    Thursday, March 6, 2008 8:46 PM
  • Anyone care to share what these libararies and methods with the rest of us?  I'm trying to do the same thing and have only used SystemParametersInfo and SPI_SETSCREENSAVETIMEOUT.  What can I use to set the executable and password protection on XP?
    Monday, October 27, 2008 8:16 PM