[已关闭问题]
关闭于 2008-01-09 21:33
<P>读注册表</P>
<P> public void GetProxySetting() <BR> { <BR> int Proxy_Enabled; <BR> //track to the SubKey <BR> RegistryKey rkey = Registry.CurrentUser; <BR> RegistryKey software = rkey.OpenSubKey("Software"); <BR> RegistryKey microsoft = software.OpenSubKey("Microsoft"); <BR> RegistryKey windows = microsoft.OpenSubKey("Windows"); <BR> RegistryKey currentversion = windows.OpenSubKey("CurrentVersion"); <BR> RegistryKey internetsettings = currentversion.OpenSubKey("Internet Settings"); <BR> Proxy_Enabled = Convert.ToInt32(internetsettings.GetValue("ProxyEnable")); <BR> //if ProxyEnable is true <BR> if (Proxy_Enabled!=0) <BR> { <BR> string ProxySettings=internetsettings.GetValue("ProxyServer").ToString(); <BR> int i = ProxySettings.IndexOf(":"); <BR> int j = ProxySettings.Length; <BR> textBox_AddressNow.Text=ProxySettings.Remove(i,j-i); <BR> textBox_PortNow.Text=ProxySettings.Remove(0,i+1); <BR> } <BR> }</P>
杜耀辉
|
菜鸟二级
|
园豆:
275
提问于:2008-01-07 13:51