How to Disable Screen saver-1 using QTP code


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.
How to Disable Screen saver-1 using QTP code How to Disable Screen saver-1 using QTP code Reviewed by Animesh Chatterjee on February 07, 2009 Rating: 5

No comments:

Powered by Blogger.