voanhkiem6 Posted June 21, 2012 Share Posted June 21, 2012 (edited) I use function "Enable" and "Disable" together in Win7. The first, I call function "Enable" , it's effect. Then "Disable" is called , but it's not effect. (In win XP is both of function are effect)$key= "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings"Func Enable() RegWrite($key,"ProxyEnable", "REG_DWORD",1) DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)EndFuncFunc Enable() RegWrite($key,"ProxyEnable", "REG_DWORD",0) DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)EndFuncEveryone help me, please!!! Thanks u very much Edited June 21, 2012 by voanhkiem6 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 21, 2012 Moderators Share Posted June 21, 2012 This works just fine on Win7 for me. Global $key = "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings" Enable() MsgBox(0, "", "Check Reg Key") Disable() Func Enable() RegWrite($key,"ProxyEnable", "REG_DWORD",1) DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0) EndFunc Func Disable() RegWrite($key,"ProxyEnable", "REG_DWORD",0) DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0) EndFunc "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
zorphnog Posted June 21, 2012 Share Posted June 21, 2012 (edited) Is this the entire script? If not, it is possible that the $key variable is being assigned elsewhere in your script. Either declare it as a constant (i.e. Global Const) or use local variables to ensure $key is what you expect it to be. Also, are you sure that the problem is with RegWrite? Have you checked the registry value after disable is executed? Edited June 21, 2012 by zorphnog Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now