Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
General Function - Lock PCIf you're leaving your PC running automated tests overnight, you might want to lock it when it's finished. If you find an error, or have a suggestion for improvement, Email me and I'll fix it. Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Sub zGen_LockPC 'This function locks your PC 'You might want to do this if you are leaving your PC running tests overnight unattended 'Example usage: ' Call zGen_LockPC Dim oShell, sCommand Set oShell = CreateObject("WScript.Shell") sCommand = "%windir%\SYSTEM32\rundll32.exe user32.dll,LockWorkStation" oShell.Run sCommand, 0, False Set oShell = Nothing End Sub '========================================================================= |