Detect Screensaver and Log Out

C

chuck.streb

Is there a routine out there that can detect when the screen saver
comes on and the close out microsoft access client frontend cleanly.

Regards
Chuck
 
R

Roger Carlson

I don't know of a way to detect the screensaver, but I do have a method to
log the user out of a database after a period of inactivity. On my website
(www.rogersaccesslibrary.com), is a small Access database sample called
"LogUsersOffNonUse.mdb" which illustrates how to do this.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
C

chuck.streb

Solution !!!



Dev Ashish View profile
Larry R Harrison Jr wrote > This works fine except when a screensaver
is going. The screensaver > seems to prevent the automatic shutdown
from executing. Has anyone > heard of this, and is there a fix short
of turning everyone's screen > saver off? You know, I had couple of
emails this week telling me of a similar problem with some other API
code I'd posted; that is, the code doesn't seem to run if the screen
saver is on. I just did a quick test in Win2000 and Access 2002, and
the Form Timer seems to be firing even when the screen saver is on.
What OS are you having this problem on? Have you tried to narrow down
the event that's not firing? My test was pretty straight-forward. Set
the form's TimerInterval to 5000, paste this code, set the screen
saver properly, and then, well, wait. :) ' **** Code Start ****
Private Declare Function SystemParametersInfo _ Lib "user32" _
Alias "SystemParametersInfoA" _ (ByVal uAction As Long, _
ByVal uParam As Long, _ lpvParam As Any, _ ByVal fuWinIni As
Long) _ As Long Private Const SPI_GETSCREENSAVERRUNNING = 114
Function fIsScreenSaverActive() As Boolean ' Win98, Win2000 only Dim
lngFlag As Long If CBool(SystemParametersInfo( _
SPI_GETSCREENSAVERRUNNING, 0, _ lngFlag, 0)) Then
fIsScreenSaverActive = CBool(lngFlag) End If End Function Private
Sub Form_Timer() Static i As Integer i = i + 1 Me.Text3 =
Me.Text3 & vbCrLf & i & " = " & fIsScreenSaverActive End Sub ' ****
Code End **** -- Dev
More options May 31 2001, 4:46 pm

Newsgroups: microsoft.public.access.modulesdaovba
From: [email protected] (Dev Ashish)
Date: Thu, 31 May 2001 13:45:04 -0700
Local: Thurs, May 31 2001 4:45 pm
Subject: Re: Timer to Close Database after Inactivity gets Overriden
by Screen Saver
Reply to author | Forward | Print | Individual message | Show original
| Report this message | Find messages by this author
Larry R Harrison Jr wrote

This works fine except when a screensaver is going. The screensaver
seems to prevent the automatic shutdown from executing. Has anyone
heard of this, and is there a fix short of turning everyone's screen
saver off?


You know, I had couple of emails this week telling me of a similar
problem
with some other API code I'd posted; that is, the code doesn't seem to
run
if the screen saver is on.

I just did a quick test in Win2000 and Access 2002, and the Form
Timer
seems to be firing even when the screen saver is on. What OS are you
having
this problem on? Have you tried to narrow down the event that's not
firing?


My test was pretty straight-forward. Set the form's TimerInterval to
5000,
paste this code, set the screen saver properly, and then, well,
wait. :)


' **** Code Start ****
Private Declare Function SystemParametersInfo _
Lib "user32" _
Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
lpvParam As Any, _
ByVal fuWinIni As Long) _
As Long


Private Const SPI_GETSCREENSAVERRUNNING = 114


Function fIsScreenSaverActive() As Boolean
' Win98, Win2000 only
Dim lngFlag As Long
If CBool(SystemParametersInfo( _
SPI_GETSCREENSAVERRUNNING, 0, _
lngFlag, 0)) Then
fIsScreenSaverActive = CBool(lngFlag)
End If
End Function


Private Sub Form_Timer()
Static i As Integer
i = i + 1
Me.Text3 = Me.Text3 & vbCrLf & i & " = " & fIsScreenSaverActive
End Sub
' **** Code End ****


-- Dev
 
Top