欢迎来到天天文库
浏览记录
ID:17429932
大小:31.50 KB
页数:6页
时间:2018-08-31
《ie浏览器注册表操作》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、IE浏览器注册表操作usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingMicrosoft.Win32;namespaceWebClick_Tool{//////注册表操作类///publicclassRegSetting{//////添加节点/////////publicstaticboolAddNodes(strin
2、gNodesPath,stringVName,stringVvalue){try{RegistryKeykey=Registry.LocalMachine;RegistryKeykey2=key.CreateSubKey(NodesPath);key2.SetValue(VName,Vvalue);returntrue;}catch{returnfalse;}}//////删除键值////////////3、rns>publicstaticboolRegeditKeyDel(stringNodesPath,ListKeyNames){RegistryKeyhkml=Registry.LocalMachine;try{string[]subkeyNames;RegistryKeysoftware=hkml.OpenSubKey(NodesPath,true);subkeyNames=software.GetValueNames();//取得该项下所有键值的名称的序列,并传递给预定的数组中foreach(stringkeyNameinsubke4、yNames){if(KeyNames.Contains(keyName))//判断键值的名称{software.DeleteValue(keyName);}}if(KeyNames.Contains("默认")){software.SetValue("","");}hkml.Close();returntrue;}catch{hkml.Close();returnfalse;}}//////删除所有键值/////////5、ram>///publicstaticboolRegeditKeyDel(stringNodesPath){RegistryKeyhkml=Registry.LocalMachine;try{string[]subkeyNames;RegistryKeysoftware=hkml.OpenSubKey(NodesPath,true);subkeyNames=software.GetValueNames();//取得该项下所有键值的名称的序列,并传递给预定的数组中foreach(stringkeyNameinsubkeyNames){i6、f(keyName.Trim()==""7、8、keyName.Trim()=="@")software.SetValue("","");elsesoftware.DeleteValue(keyName);}hkml.Close();returntrue;}catch{hkml.Close();returnfalse;}}//////设置注册表键值/////////publicstaticboolSetReg(Listkeys){tr9、y{RegeditKeyDel("SOFTWARE\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\UserAgent\PostPlatform");if(keys.Count>1&&keys[0].Contains("Mozilla/")){AddNodes("SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\UserAgent","",k
3、rns>publicstaticboolRegeditKeyDel(stringNodesPath,ListKeyNames){RegistryKeyhkml=Registry.LocalMachine;try{string[]subkeyNames;RegistryKeysoftware=hkml.OpenSubKey(NodesPath,true);subkeyNames=software.GetValueNames();//取得该项下所有键值的名称的序列,并传递给预定的数组中foreach(stringkeyNameinsubke
4、yNames){if(KeyNames.Contains(keyName))//判断键值的名称{software.DeleteValue(keyName);}}if(KeyNames.Contains("默认")){software.SetValue("","");}hkml.Close();returntrue;}catch{hkml.Close();returnfalse;}}//////删除所有键值/////////5、ram>///publicstaticboolRegeditKeyDel(stringNodesPath){RegistryKeyhkml=Registry.LocalMachine;try{string[]subkeyNames;RegistryKeysoftware=hkml.OpenSubKey(NodesPath,true);subkeyNames=software.GetValueNames();//取得该项下所有键值的名称的序列,并传递给预定的数组中foreach(stringkeyNameinsubkeyNames){i6、f(keyName.Trim()==""7、8、keyName.Trim()=="@")software.SetValue("","");elsesoftware.DeleteValue(keyName);}hkml.Close();returntrue;}catch{hkml.Close();returnfalse;}}//////设置注册表键值/////////publicstaticboolSetReg(Listkeys){tr9、y{RegeditKeyDel("SOFTWARE\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\UserAgent\PostPlatform");if(keys.Count>1&&keys[0].Contains("Mozilla/")){AddNodes("SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\UserAgent","",k
5、ram>///publicstaticboolRegeditKeyDel(stringNodesPath){RegistryKeyhkml=Registry.LocalMachine;try{string[]subkeyNames;RegistryKeysoftware=hkml.OpenSubKey(NodesPath,true);subkeyNames=software.GetValueNames();//取得该项下所有键值的名称的序列,并传递给预定的数组中foreach(stringkeyNameinsubkeyNames){i
6、f(keyName.Trim()==""
7、
8、keyName.Trim()=="@")software.SetValue("","");elsesoftware.DeleteValue(keyName);}hkml.Close();returntrue;}catch{hkml.Close();returnfalse;}}//////设置注册表键值/////////publicstaticboolSetReg(Listkeys){tr
9、y{RegeditKeyDel("SOFTWARE\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\UserAgent\PostPlatform");if(keys.Count>1&&keys[0].Contains("Mozilla/")){AddNodes("SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\UserAgent","",k
此文档下载收益归作者所有