Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Visual Basic (Microsoft) Versions 5/6 FAQ


How can I turn on the windows screen saver? by Michael42
Posted: 13 Feb 03

Microsoft Windows starts screen savers through the System-menu box on a form. The System-menu box is also known as the Control-menu box in Visual Basic. You can send Windows messages to the Control-menu box by using the SendMessage Windows API (application programming interface) function.

Add the following to the general declarations section of Form1, or to
a .Bas module file, in Visual Basic:

 ' The following Declare statement must be on one, single line:
   Declare Function SendMessage Lib "User" (ByVal hWnd As Integer,
  ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long

In the following example, a command button starts the Form1 screen saver:

   Sub Command1_Click ()
      Dim result As Long
      Const WM_SYSCOMMAND = &H112

      Const SC_SCREENSAVE = &HF140
      result = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0&)
   End Sub

Back to Visual Basic (Microsoft) Versions 5/6 FAQ Index
Back to Visual Basic (Microsoft) Versions 5/6 Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close