Results 1 to 3 of 3

Thread: Start Screen Saver

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    83

    Start Screen Saver

    I have written the code to start the Screen Saver in both C and VB, the C code works fine, but for some reason, the VB code opens up the dialoge box that warns windows is about to go into tand by. I am confused, I'm sending C the same parameters as VB, but they are behaving differently.

    My code:

    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long

    Const WM_SYSCOMMAND = &H112
    Const SC_SCREENSAVE = &HF140&

    Private Sub SomeSub()
    SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0)
    End Sub


    Thankyou, akia

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Try changing:

    Code:
    SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0)
    To

    Code:
    SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_SCREENSAVE, ByVal 0&)
    It's just a hunch, but I've seen this fix weird problems before.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    83
    Incredible, thanks heaps. It wasn't overly important, but it was bugging me.

    Works perfectly now.

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