How to Stop Screen Lock using QTP

February 08, 2009

This code is written and donated by Aditi.The objective of this code is to combat the screen saver activated while running for the long execution..(say--4000 lines of row)

This sample piece of code gives a mouse move which stops to activate screen saver.

Function Handle_SystemLock(Object, Method, Arguments, retVal)
Set o=CreateObject("Mercury.DeviceReplay")
o.mouseMove second(now),100
Set o=Nothing
End Function

Thank you aditi for the help and donation of the code.

Some more technique can be used...

use runtime co-ordinates "x" and "y" with mercury device replay feature,this should help u click on the item.


set obj=createobject("Mercury.devicereplay")
obj.mousemove xcord + somevalue , ycord+somevalue
obj.mousedblclick xcord + somevalue , ycord+somevalue,0

You Might Also Like


  1. Nice one...thanks aditi and animesh for your gave me a chance to go out from my seat while the execution is going on.

    Fantastic approach.