Custom Search

Wednesday, November 21, 2012

To set automatically detect settings On/Off in IE

'Example use of IEautomaticallydetect
 IEautomaticallydetect  "off"
 IEautomaticallydetect  "show"
 IEautomaticallydetect  "on"
 IEautomaticallydetect  "show"
 
 SUB IEautomaticallydetect (status)  

 DIM sKey,sValue,binaryVal
 Dim oReg
 Set oReg=GetObject( "winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")     
 Const HKCU=&H80000001
 
 sKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
 sValue = "DefaultConnectionSettings"  
 oReg.GetBinaryValue HKCU, sKey, sValue, binaryVal
 
 select case lcase(status)
   case "on"    binaryVal(8) = binaryVal(8) OR 8      'Force Autodetect on
   case "off"    binaryVal(8) = binaryVal(8) XOR 8    'Force Autodetect off
   case "show" print  "Automatically detect is set to " & ((binaryVal(8) and 8) = 8)
   case else    print  "Invalid parameter - IEautomaticallydetect  on, off or show"
 end select
 
 if lcase(status)="on" or lcase(status)="off" then oReg.SetBinaryValue HKCU, sKey, sValue, binaryVal
 
 end sub

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.