A message for screen saver activating. 
Author Message
 A message for screen saver activating.

I want to be able to know from within my running VB application when the
screen saver has kicked in. How do I do that?
If that cannot be done then is there some way where each time there is
some keyboard or mouse activity during the running of my VB app a timer
is reset?


Wed, 11 Feb 1998 03:00:00 GMT  
 A message for screen saver activating.

Quote:

>I want to be able to know from within my running VB application when the
>screen saver has kicked in. How do I do that?
>If that cannot be done then is there some way where each time there is
>some keyboard or mouse activity during the running of my VB app a timer
>is reset?

        If you have message blaster you can listen for WM_SYSCOMMAND messages
with wparam=SC_SCREENSAVE - you get a message like that just before the
screensaver starts. (And you can prevent the sceensaver from starting by
returning something non-zero.)

--
David Ullrich
Don't you guys find it tedious typing the same thing
after your signature each time you post something?
I know I do, but when in Rome...



Thu, 12 Feb 1998 03:00:00 GMT  
 A message for screen saver activating.
Quote:

>I want to be able to know from within my running VB application when the
>screen saver has kicked in. How do I do that?
>If that cannot be done then is there some way where each time there is
>some keyboard or mouse activity during the running of my VB app a timer
>is reset?

Here is a little BAS fie that will surely help anyone interested in writing screen savers
hope it helps
Curt

'****************************************************
'* SSAVER.BAS Version 2.0 Date: 02/01/95            *
'* VB Tips & Tricks                                 *
'* 8430-D Summerdale Road San Diego CA 92126-5415   *
'* Compuserve: 74227,1557                           *
'* America On-Line: DPMCS                           *

'****************************************************
Option Explicit
Dim res As Integer
Const SPI_GETSCREENSAVEACTIVE = 16
Const SPI_SETSCREENSAVEACTIVE = 17
Declare Function SystemParametersInfo Lib "User" (ByVal uAction As Integer, ByVal uparam As Integer, lpvParam As Any, ByVal fuWinIni As Integer) As Integer
Declare Function ShowCursor Lib "User" (ByVal bShow As Integer) As Integer

'tURN CURSOR BACK ON TURN SCREEN SAVER BACK ON
Sub ExitNice ()
    res = ShowCursor(True)  'Turn the cursor back on
    'reset screensaver
    res = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, ByVal 0&, 0)
    End
  End Sub

Function iIsSaverActive () As Integer
Dim iActive As Integer
Dim R As Integer

    R = SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, iActive, 0)
    iIsSaverActive = iActive

End Function

'*******************************************************
'* Procedure Name: PassXor                             *
'*-----------------------------------------------------*
'* Created: 3/01/94   By: John Hayward                 *
'* Modified:          By:                              *
'*=====================================================*
'*This sub is used in the EncriptPassWord function.    *
'*******************************************************
Sub PassXor (x1 As Integer, x2 As Integer)

  Select Case x2 Xor x1
    Case 0 To 32, 127 To 144, 147 To 159, 61, 91, 93
      ' not allowed
    Case Else
      x2 = x2 Xor x1
  End Select

End Sub

'*******************************************************
'* Procedure Name: SavePassWord                        *
'*-----------------------------------------------------*
'* Created: 3/01/94   By: David McCarter               *
'* Modified:          By:                              *
'*=====================================================*
'*This sub will save your password encrypted with the  *
'*EncryptPassWord sub routine to the CONTROL.INI file  *
'*******************************************************
Sub SavePassWord (sPassWord As String)
'Dim R As Integer

 '   Call WriteINI("ScreenSaver", "Password", sPassWord, "Control.Ini")

End Sub

'*******************************************************
'* Procedure Name: SaverActive                         *
'*-----------------------------------------------------*
'* Created: 2/1/95    By: David McCarter               *
'* Modified:          By:                              *
'*=====================================================*
'*Use this to notify Windows that your screen saver    *
'*is active. This prevents Windows from turning it off *
'*after the alloted time in the screen saver setup     *
'*pannel.                                              *
'*                                                     *
'*******************************************************
Sub saveractive ()
Dim R As Integer

    R = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, ByVal 0&, 0)

End Sub

'*******************************************************
'* Procedure Name: SaverNotActive                      *
'*-----------------------------------------------------*
'* Created: 2/1/95    By: David McCarter               *
'* Modified:          By:                              *
'*=====================================================*
'*Use this to notify Windows that your screen saver has*
'*ended. This will allow Windows to turn on the screen *
'*saver again after the alloted time specified in the  *
'*screen saver setup pannel.                           *
'*                                                     *
'*******************************************************
Sub SaverNotActive ()
Dim R As Integer

 R = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, ByVal 0&, 0)

End Sub

'*******************************************************
'* Procedure Name: EncryptPassWord                     *
'*-----------------------------------------------------*
'* Created: 3/01/94   By: John Hayward                 *
'* Modified:          By:                              *
'*=====================================================*
'*This sub will encrypt a string to be that is         *
'*compatible with the Microsoft screen saver passwords.*
'*Use this sub routine before using the SavePassWord   *
'*sub and for checking for a valid password as been    *
'*entered.                                             *
'*******************************************************
Function sEncryptPassWord (ByVal sArg As String) As String
Dim iArgPt As Integer
Dim iArgChar As Integer
Dim iArgLen As Integer

    iArgLen = Len(sArg)
    If iArgLen = 0 Then Exit Function' Nothing to check
    sArg = UCase$(sArg)

    'First Pass
    For iArgPt = 1 To iArgLen
        iArgChar = Asc(Mid$(sArg, iArgPt, 1))
        Call PassXor(iArgLen, iArgChar)

        If iArgPt = 1 Then
            Call PassXor(42, iArgChar)
            Else
                Call PassXor(iArgPt - 1, iArgChar)
                Call PassXor(Asc(Mid$(sArg, iArgPt - 1)), iArgChar)
        End If

        Mid$(sArg, iArgPt, 1) = Chr$(iArgChar)
    Next

    'Second Pass
    If iArgLen > 1 Then
        For iArgPt = iArgLen To 1 Step -1
            iArgChar = Asc(Mid$(sArg, iArgPt, 1))
            Call PassXor(iArgLen, iArgChar)

            If iArgPt = iArgLen Then
                Call PassXor(42, iArgChar)
                Else
                    Call PassXor(iArgPt - 1, iArgChar)
                    Call PassXor(Asc(Mid$(sArg, iArgPt + 1, 1)), iArgChar)
            End If

            Mid$(sArg, iArgPt, 1) = Chr$(iArgChar)
        Next
    End If

    sEncryptPassWord = sArg

End Function

'*******************************************************
'* Procedure Name: sGetPassWord                        *
'*-----------------------------------------------------*
'* Created: 3/01/94   By: David McCarter               *
'* Modified:          By:                              *
'*=====================================================*
'*This sub will read the encrypted password from the   *
'*CONTROL.INI file. Use the EncryptPassWord sub to     *
'*compare.                                             *
'*******************************************************
Function sGetPassWord () As String
'Dim sTempPass As String

 '   sTempPass = sReadINI("ScreenSaver", "Password", "Control.Ini")
  '  sGetPassWord = sTempPass

End Function



Fri, 13 Feb 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Activate Screen Saver with VB.Net

2. Activating the Win95 Screen Saver

3. How to activate Screen Saver?

4. Activating screen saver in NT 4.0

5. Activating an OLE Screen Saver

6. Activating the Win95 Screen Saver

7. activate a screen saver on NT system

8. Activating Windows 98 Default Screen Saver

9. Screen Saver on top of Screen Saver problem

10. screen saver & screen 9

11. Using StretchBlt to capture screen image to screen saver preview pane

12. Shifting Screen screen saver?

 

 
Powered by phpBB® Forum Software