Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Group policy screensaver - turn it off!

Hi,

I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.

I have the following programming tools available:

1. VBA
2. Python compiler

and, er, that's it...

Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!

I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...




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


Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub


Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Group policy screensaver - turn it off!

Chris,

They won't let me turn the screensaver off.


"They" are idiots. Since their policy is directly interfering with your work, take your complaint
up the food-chain until a bigger fish tells them to change it.

In the mean time, I have heard that

http://www.rjlsoftware.com/software/utility/stopss/

will prevent your screensaver from kicking in. Not tested....

HTH,
Bernie
MS Excel MVP


wrote in message
ups.com...
Hi,

I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.

I have the following programming tools available:

1. VBA
2. Python compiler

and, er, that's it...

Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!

I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...




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


Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub


Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Group policy screensaver - turn it off!

Actually, I've just tried that code and it didn't work! Any other
ideas?

Cheers,

Chris




On Jun 5, 6:51 pm, wrote:
Hi,

I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.

I have the following programming tools available:

1. VBA
2. Python compiler

and, er, that's it...

Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!

I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...

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

Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub

Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Group policy screensaver - turn it off!


Thanks for that Bernie, I suspect that the same group policy will
prevent me from installing anything new on the machine, but I'll give
it a try :)

I was looking up the sendinput API call - any view on whether that
would simulate a mouse movement? It looks like it wouldn't be
interpreted as a hardware movement, so wouldn't stop the screensaver
(and associated password protect) kicking in.

Cheers,

Chris




On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Chris,

They won't let me turn the screensaver off.


"They" are idiots. Since their policy is directly interfering with your work, take your complaint
up the food-chain until a bigger fish tells them to change it.

In the mean time, I have heard that

http://www.rjlsoftware.com/software/utility/stopss/

will prevent your screensaver from kicking in. Not tested....

HTH,
Bernie
MS Excel MVP

wrote in message

ups.com...



Hi,


I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.


I have the following programming tools available:


1. VBA
2. Python compiler


and, er, that's it...


Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?


I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!


I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...


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


Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub


Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Group policy screensaver - turn it off!

Chris,
A quick bit of testing on my system (W2K), shows that printing anything to
debug prevents the ScreenSaver kicking in.
If you halt the code or the code finishes, then the screen saver starts up,
but surely by then it's not a problem.
Screen saver set to 1 min:

Also, the DoEvents seems necssary if the Screen Saver does kick in to allow
you to get rid of it. Maybe try that first.

'Option Explicit
Private Sub CommandButton1_Click()
Dim arr(1 To 1000000) As Variant

Dim starttime As Date

starttime = Now
For j = 1 To 20
For i = 1 To 1000000
'Just some longish calculation
arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3
Next
Debug.Print Format(Now() - starttime, "ss")
Erase arr
' DoEvents
Next
End Sub

NickHK

wrote in message
ps.com...

Thanks for that Bernie, I suspect that the same group policy will
prevent me from installing anything new on the machine, but I'll give
it a try :)

I was looking up the sendinput API call - any view on whether that
would simulate a mouse movement? It looks like it wouldn't be
interpreted as a hardware movement, so wouldn't stop the screensaver
(and associated password protect) kicking in.

Cheers,

Chris




On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Chris,

They won't let me turn the screensaver off.


"They" are idiots. Since their policy is directly interfering with your

work, take your complaint
up the food-chain until a bigger fish tells them to change it.

In the mean time, I have heard that

http://www.rjlsoftware.com/software/utility/stopss/

will prevent your screensaver from kicking in. Not tested....

HTH,
Bernie
MS Excel MVP

wrote in message

ups.com...



Hi,


I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.


I have the following programming tools available:


1. VBA
2. Python compiler


and, er, that's it...


Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?


I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!


I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...


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


Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub


Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub- Hide quoted text -


- Show quoted text -







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Group policy screensaver - turn it off!

Correction:
Whilst, surprisingly, this did work before (honest), it now seems not to.

NickHK

"NickHK" wrote in message
...
Chris,
A quick bit of testing on my system (W2K), shows that printing anything to
debug prevents the ScreenSaver kicking in.
If you halt the code or the code finishes, then the screen saver starts

up,
but surely by then it's not a problem.
Screen saver set to 1 min:

Also, the DoEvents seems necssary if the Screen Saver does kick in to

allow
you to get rid of it. Maybe try that first.

'Option Explicit
Private Sub CommandButton1_Click()
Dim arr(1 To 1000000) As Variant

Dim starttime As Date

starttime = Now
For j = 1 To 20
For i = 1 To 1000000
'Just some longish calculation
arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3
Next
Debug.Print Format(Now() - starttime, "ss")
Erase arr
' DoEvents
Next
End Sub

NickHK

wrote in message
ps.com...

Thanks for that Bernie, I suspect that the same group policy will
prevent me from installing anything new on the machine, but I'll give
it a try :)

I was looking up the sendinput API call - any view on whether that
would simulate a mouse movement? It looks like it wouldn't be
interpreted as a hardware movement, so wouldn't stop the screensaver
(and associated password protect) kicking in.

Cheers,

Chris




On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Chris,

They won't let me turn the screensaver off.

"They" are idiots. Since their policy is directly interfering with

your
work, take your complaint
up the food-chain until a bigger fish tells them to change it.

In the mean time, I have heard that

http://www.rjlsoftware.com/software/utility/stopss/

will prevent your screensaver from kicking in. Not tested....

HTH,
Bernie
MS Excel MVP

wrote in message

ups.com...



Hi,

I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.

I have the following programming tools available:

1. VBA
2. Python compiler

and, er, that's it...

Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my

model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!

I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...

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

Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub

Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub- Hide quoted text -

- Show quoted text -







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Group policy screensaver - turn it off!

Thanks Nick Have to say, this doesn't work for me either
unfortunately! :(

I'm thinking of resorting to a hardware solution - having a rotating
disk against my (optical) mouse!

Cheers,

Chris


On Jun 6, 11:22 am, "NickHK" wrote:
Correction:
Whilst, surprisingly, this did work before (honest), it now seems not to.

NickHK

"NickHK" wrote in message

...



Chris,
A quick bit of testing on my system (W2K), shows that printing anything to
debug prevents the ScreenSaver kicking in.
If you halt the code or the code finishes, then the screen saver starts

up,
but surely by then it's not a problem.
Screen saver set to 1 min:


Also, the DoEvents seems necssary if the Screen Saver does kick in to

allow
you to get rid of it. Maybe try that first.


'Option Explicit
Private Sub CommandButton1_Click()
Dim arr(1 To 1000000) As Variant


Dim starttime As Date


starttime = Now
For j = 1 To 20
For i = 1 To 1000000
'Just some longish calculation
arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3
Next
Debug.Print Format(Now() - starttime, "ss")
Erase arr
' DoEvents
Next
End Sub


NickHK


wrote in message
ups.com...


Thanks for that Bernie, I suspect that the same group policy will
prevent me from installing anything new on the machine, but I'll give
it a try :)


I was looking up the sendinput API call - any view on whether that
would simulate a mouse movement? It looks like it wouldn't be
interpreted as a hardware movement, so wouldn't stop the screensaver
(and associated password protect) kicking in.


Cheers,


Chris


On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Chris,


They won't let me turn the screensaver off.


"They" are idiots. Since their policy is directly interfering with

your
work, take your complaint
up the food-chain until a bigger fish tells them to change it.


In the mean time, I have heard that


http://www.rjlsoftware.com/software/utility/stopss/


will prevent your screensaver from kicking in. Not tested....


HTH,
Bernie
MS Excel MVP


wrote in message


oups.com...


Hi,


I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.


I have the following programming tools available:


1. VBA
2. Python compiler


and, er, that's it...


Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my

model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!


I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...


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


Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub


Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Group policy screensaver - turn it off!

Chris,
Whilst this works in preventing the screen saver from starting, its use of
SendKeys is somewhat unpredictable if you intend to continue working with
Windows whilst your simulation is running.
You could add a checkbox to indicate if you are running "Unattended", then
execute the SendKeys code; otherwise there is no point executing it, as your
own activity would prevent the SS from starting.
If you are just clicking a WS button and walking away, this <should work.

After loking at various other suggestion:
- Registry settings which I assume are not accessible for you
- SwitchDesktop API
- Various mouse/keyboard API
I could not get any to work in my open environment, so I serious doubt they
would work in your environment.

Private Sub CommandButton1_Click()
Dim i As Long, j As Long
Dim arr(1 To 1000000) As Variant

Range("D1").Select

For j = 1 To 20
For i = 1 To 1000000
arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3
Next

Debug.Print "Run: " & j

Erase arr
DoEvents

Application.ScreenUpdating = True
SendKeys "{F2}"
SendKeys "{ESC}"
Application.ScreenUpdating = False
Next

End Sub

NickHK

wrote in message
ps.com...
Thanks Nick Have to say, this doesn't work for me either
unfortunately! :(

I'm thinking of resorting to a hardware solution - having a rotating
disk against my (optical) mouse!

Cheers,

Chris


On Jun 6, 11:22 am, "NickHK" wrote:
Correction:
Whilst, surprisingly, this did work before (honest), it now seems not

to.

NickHK

"NickHK" wrote in message

...



Chris,
A quick bit of testing on my system (W2K), shows that printing

anything to
debug prevents the ScreenSaver kicking in.
If you halt the code or the code finishes, then the screen saver

starts
up,
but surely by then it's not a problem.
Screen saver set to 1 min:


Also, the DoEvents seems necssary if the Screen Saver does kick in to

allow
you to get rid of it. Maybe try that first.


'Option Explicit
Private Sub CommandButton1_Click()
Dim arr(1 To 1000000) As Variant


Dim starttime As Date


starttime = Now
For j = 1 To 20
For i = 1 To 1000000
'Just some longish calculation
arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3
Next
Debug.Print Format(Now() - starttime, "ss")
Erase arr
' DoEvents
Next
End Sub


NickHK


wrote in message
ups.com...


Thanks for that Bernie, I suspect that the same group policy will
prevent me from installing anything new on the machine, but I'll

give
it a try :)


I was looking up the sendinput API call - any view on whether that
would simulate a mouse movement? It looks like it wouldn't be
interpreted as a hardware movement, so wouldn't stop the screensaver
(and associated password protect) kicking in.


Cheers,


Chris


On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Chris,


They won't let me turn the screensaver off.


"They" are idiots. Since their policy is directly interfering

with
your
work, take your complaint
up the food-chain until a bigger fish tells them to change it.


In the mean time, I have heard that


http://www.rjlsoftware.com/software/utility/stopss/


will prevent your screensaver from kicking in. Not tested....


HTH,
Bernie
MS Excel MVP


wrote in message


oups.com...


Hi,


I have a rather restricitve group policy set on my machine. I

look
after a monte carlo simulation model, written in VBA, which

annoying
breaks whenever the screensaver kicks in. They won't let me turn

the
screensaver off. I have tried.


I have the following programming tools available:


1. VBA
2. Python compiler


and, er, that's it...


Does anyone know any vba hacks (or at a stretch a python hack)

which
could stop my screensaver locking every 15 minutes, breaking my

model?

I don't care how it does it - simulate a mouse movement, type a

key,
turn the screensaver off... anything - it's becoming desperate!


I found the following in this newsgroup, but not sure it would

work
with a group policy screensaver (Don Bardner, original

author)...

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


Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,

OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub


Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Group policy screensaver - turn it off!

Create a vb script with the following:

Option Explicit
Dim WSHShell, regVal

Set WSHShell = WScript.CreateObject("WScript.Shell")

regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\"
regVal=regVal & "ScreenSaveTimeOut"
WSHShell.RegDelete regVal

regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\"
regVal=regVal & "ScreenSaverIsSecure"
WSHShell.RegDelete regVal

Set WSHShell=Nothing


" wrote:

Actually, I've just tried that code and it didn't work! Any other
ideas?

Cheers,

Chris




On Jun 5, 6:51 pm, wrote:
Hi,

I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.

I have the following programming tools available:

1. VBA
2. Python compiler

and, er, that's it...

Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!

I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...

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

Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub

Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default Group policy screensaver - turn it off!

Ralph,
Unless I'm missing something, if the group policy bars the OP from changing
the settings manually, how will the OP have permission to those keys ?

NickHK

"Ralph" ...
Create a vb script with the following:

Option Explicit
Dim WSHShell, regVal

Set WSHShell = WScript.CreateObject("WScript.Shell")

regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\"
regVal=regVal & "ScreenSaveTimeOut"
WSHShell.RegDelete regVal

regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\"
regVal=regVal & "ScreenSaverIsSecure"
WSHShell.RegDelete regVal

Set WSHShell=Nothing


" wrote:

Actually, I've just tried that code and it didn't work! Any other
ideas?

Cheers,

Chris




On Jun 5, 6:51 pm, wrote:
Hi,

I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.

I have the following programming tools available:

1. VBA
2. Python compiler

and, er, that's it...

Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!

I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...

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

Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub

Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub








  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Group policy screensaver - turn it off!

Where I work you can't even open the registry with the policy they have set,
but they can't block you from deleting the keys. The only problem I see with
this solution is every time the policy is implemented the script would need
to be re-run or it could be part of the Excel macro.

"NickHK" wrote:

Ralph,
Unless I'm missing something, if the group policy bars the OP from changing
the settings manually, how will the OP have permission to those keys ?

NickHK

"Ralph" ...
Create a vb script with the following:

Option Explicit
Dim WSHShell, regVal

Set WSHShell = WScript.CreateObject("WScript.Shell")

regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\"
regVal=regVal & "ScreenSaveTimeOut"
WSHShell.RegDelete regVal

regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\"
regVal=regVal & "ScreenSaverIsSecure"
WSHShell.RegDelete regVal

Set WSHShell=Nothing


" wrote:

Actually, I've just tried that code and it didn't work! Any other
ideas?

Cheers,

Chris




On Jun 5, 6:51 pm, wrote:
Hi,

I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.

I have the following programming tools available:

1. VBA
2. Python compiler

and, er, that's it...

Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!

I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...

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

Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub

Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub






  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Group policy screensaver - turn it off!

Maybe try a web based MonteCarlo simulation
instead of Excel based.

Try VanguardSystem from Vanguard Software
The thing is Web based, and I believe you can even run
on their servers so you can do an end run around any
policies on local machines. It's also a whole lot faster
than Excel





On Jun 5, 12:51 pm, wrote:
Hi,

I have a rather restricitve group policy set on my machine. I look
after a monte carlo simulation model, written in VBA, which annoying
breaks whenever the screensaver kicks in. They won't let me turn the
screensaver off. I have tried.

I have the following programming tools available:

1. VBA
2. Python compiler

and, er, that's it...

Does anyone know any vba hacks (or at a stretch a python hack) which
could stop my screensaver locking every 15 minutes, breaking my model?

I don't care how it does it - simulate a mouse movement, type a key,
turn the screensaver off... anything - it's becoming desperate!

I found the following in this newsgroup, but not sure it would work
with a group policy screensaver (Don Bardner, original author)...

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

Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff,
ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub

Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allow Trusted Locations on my network - Group Policy (GP) AKA Bones Excel Discussion (Misc queries) 3 April 21st 23 09:03 PM
How do I turn off [Group] mode? tothemax Excel Discussion (Misc queries) 4 April 2nd 23 08:13 PM
Macro Security for Excel 2007 (group policy) justmark Setting up and Configuration of Excel 3 July 29th 07 12:53 PM
How does one turn off gridlines only in a group of cells? cmhoover Excel Worksheet Functions 2 November 6th 06 11:37 PM
Macro run slow when turn on ScreenSaver Bill Li Excel Programming 0 October 30th 03 03:28 AM


All times are GMT +1. The time now is 10:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"