Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Registry change at startup not working

Status
Not open for further replies.

PPettit

IS-IT--Management
Sep 13, 2003
511
US
I run a script at startup to prevent apps from stealing window focus. Actually, I use Microsoft's TweakUI powertoy, but it gets overridden by another application that runs after it does. My script is an attempt to change things back to what TweakUI set.

Code:
Option Explicit
Dim objShell

Set objShell = WScript.CreateObject("WScript.shell")
objShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\ForegroundLockTimeout", 200000, "REG_DWORD"

The registry change is successful, but it doesn't appear to do anything. Window focus still gets changed until I change the setting again via TweakUI.

Is there some kind of process for making my change active once the edit has been completed?
 
Try adding this to the end of your script.

Code:
objShell.AppActivate "Program Manager"
objShell.SendKeys "{F5}"

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Thanks for the input Mark, but I didn't notice any change in behavior after using your suggestion.
 
Hmm, sorry. I was hoping a desktop refresh would do it.

Some keys don't take effect until after a login event. is that the case with this one?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
The micorsoft article on the subject specifies a restart after making the registry change. Although they do after most registry changes and while many work without, perhaps this is one of the ones that doesn't. [ponder]

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top