CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2001
    Posts
    155

    changing ...........

    how would i make a program that let's you change the screensaver for windows??

    --ant


  2. #2
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: changing ...........

    There is an API function SystemParametersInfo() that can set the screensaver for you.

    -Cool Bizs

    Good Luck,
    -Cool Bizs

  3. #3
    Join Date
    May 2001
    Posts
    155

    Re: changing ...........

    How/where would i put that in my code?

    --Ant

  4. #4
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: changing ...........

    Really sorry, gotta wrong function. SystemParametersInfo() function can only set ENABLE/DISABLE/TIMEOUT VALUE parameters. To change the screensaver itself, you'll need to modify a registry key: HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE. Set the value of the item to the new screensaver filename (fullpath).

    -Cool Bizs

    Good Luck,
    -Cool Bizs

  5. #5
    Join Date
    May 2001
    Posts
    155

    Re: changing ...........

    So what would i put in the form code? type the code so i can copy it into my project

    --Ant
    ------------------------------------------------------------------------------------------------------------------------
    Want Free Software?
    E-mail me @: [email protected]

  6. #6
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: changing ...........

    I don't really have the code handy but I'm sure the explanation from MSDN is suficient for with the logic flow below:

    1. Use RegOpenKeyEx() to open HKEY_CURRENT_USER\Control Panel\Desktop
    2. Use RegSetValue() to set the SCRNSAVE.EXE value for the opened key above to the new path (ex: c:\winnt\myscrnsave.scr)
    3. Use RegCloseKey() to close the opened key from 1.
    4. Notify all windows that you've change the system registry by using SendMessageTimeout() function. You need to set the first parameter to HWND_BROADCAST and the second parameter to WM_SETTINGCHANGE (both are constants - need to get the value from MSDN).

    -Cool Bizs

    Good Luck,
    -Cool Bizs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured