How to Disable Screen saver-1 using QTP code

February 07, 2009


Here is a simple code/Function to Disable/Enable the Screen Saver.
This one more sample code for Disable Screen saver-1 using QTP code
Check out this..
http://www.askqtp.com/2009/02/disabiling-screen-saver-1.html 
http://www.askqtp.com/2009/02/stop-screen-lock.html


Function DisablescreenSaver()
Dim WSHShell, RegKey, ScreenSaver, Result
Set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKCU\Control Panel\Desktop\"
ScreenSaver = WSHShell.RegRead (regkey & "ScreenSaveActive")
If ScreenSaver = 1 Then 'Screen Saver is Enabled
Result = MsgBox("Your screen saver is currently active." & _
vbNewLine & "Would you like to disable it?", 36)
If Result = 6 Then 'clicked yes
WSHShell.RegWrite regkey & "ScreenSaveActive", 0
End If
Else 'Screen Saver is Disabled
Result = MsgBox("Your screen saver is currently disabled." & _
vbNewLine & "Would you like to enable it?", 36)
If Result = 6 Then 'clicked yes
WSHShell.RegWrite regkey & "ScreenSaveActive", 1
End If
End If
End Function
This is working fine for some cases but for system it is working properly but without any effect.Please try this and let me know.

You Might Also Like

0 comments