CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    1

    How to run a Screen Saver

    I have been trying to find a way to execute a screen saver. I have a program (Written in MFC) that enables or disables the current screen saver. I would like to add the capability to execute the screen saver imediately. Can some one give me some help?

    Thanks,
    Jeff Myers



  2. #2
    Join Date
    May 1999
    Posts
    34

    Re: How to run a Screen Saver

    Wow! You must be making the program I just finished making...I just finished one that allows the user to enable/disable/activate the SS and allows for rebooting/logging off Win. Also, I just figured out how to change the monitor's resolution. If you want any of this code as well, just let me know.

    Well, anyway the code for activating the SS was given to me here at CodeGuru by an anonymous source...it works very well. Here you go:

    CDialog dlg;
    dlg.Create(IDD_LAUNCHSS_DLG);
    dlg.SendMessage(WM_SYSCOMMAND, SC_SCREENSAVE);
    dlg.DestroyWindow();

    As long as a dialog resource exists within the application that is identified by IDD_LAUNCHSS_DLG, the user's presently defined screen saver is fired off.

    I tried some other methods and they never worked...this one works extremely well. Notice there is no call to DoModal(); therefore no dialog is truly shown, it just is called so that the SendMessage routine works...I think?!

    Anyway...
    Good luck,
    Marc

    P.S. I've been working a lot w/SS routines lately, so if you need any help...I'll try.


  3. #3
    Join Date
    Jan 2001
    Posts
    1

    Re: How to run a Screen Saver

    Is there a way to stop the Screen saver by program. For example after a sleep of 10 seconds. If there is a way does it also work with a password protected screen saver.


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