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

    how to start screensave & how to disable entering screensave if screensave has setuped?

    thans.


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: how to start screensave & how to disable entering screensave if screensave has setuped?

    Start screensaver

    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const WM_SYSCOMMAND = &H112
    Private Const SC_SCREENSAVE = &HF140&


    Private Sub Command1_Click()
    SendMessage hwnd, WM_SYSCOMMAND, SC_SCREENSAVE, ByVal 0&
    End Sub


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: how to start screensave & how to disable entering screensave if screensave has setuped?

    Enable/disable screensaver

    Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Long, ByVal fuWinIni As Long) As Long
    Private Const SPI_SETSCREENSAVEACTIVE = 17

    Private Sub cmdDisabled_Click()
    ToggleScreenSaverActive (False)
    cmdEnabled.Enabled = True
    cmdDisabled.Enabled = False
    End Sub

    Private Sub cmdEnabled_Click()
    ToggleScreenSaverActive (True)
    cmdEnabled.Enabled = False
    cmdDisabled.Enabled = True
    End Sub

    Private Sub Form_Load()
    cmdEnabled.Enabled = True
    cmdEnabled.Enabled = False
    End Sub

    Public Function ToggleScreenSaverActive(Active As Boolean) As Boolean
    Dim lActiveFlag As Long
    Dim retvaL As Long
    lActiveFlag = IIf(Active, 1, 0)
    retvaL = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, 0, 0)
    ToggleScreenSaverActive = retvaL > 0
    End Function




    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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