atfzz3

atfzz3

  • NA
  • 1
  • 0

[C#] Need help for Using WMI to set Proxy Settings

May 6 2004 11:29 AM
Hello ! I'm a beginner in C# developpement and I want to set up Internet Explorer Proxy settings with WMI. And, using Win32_Proxy and SetProxySetting method, it work !!! My code look like that : string requeteProxy = "SELECT * FROM Win32_Proxy" ; ManagementObjectSearcher MOSearchProxy = new ManagementObjectSearcher(requeteProxy); ManagementObjectCollection MOCollectionProxy = MOSearchProxy.Get(); foreach( ManagementObject MOProxy in MOCollectionProxy ) { try { ManagementBaseObject objNewProxy = null; ManagementBaseObject objSetProxy = null; objNewProxy = MOProxy.GetMethodParameters("SetProxySetting"); objNewProxy["ProxyServer"] = textBoxProxyIP.Text; objNewProxy["ProxyPortNumber"] = textBoxProxyPort.Text; objSetProxy = MOProxy.InvokeMethod("SetProxySetting", objNewProxy, null); } catch ( Exception ex ) { MessageBox.Show( "Erreur lors du paramétrage du Proxy : " + ex.Message ) ; } } Everything is ok, but when I want to load a Network profil without Proxy Setting, I don't know how disable Internet Explorer Proxy Use. If someone cant help me .... thanks to him =)