RegistryKey software = hklm.OpenSubKey ( "HARDWARE", true ) ;
RegistryKey dddw = software.OpenSubKey ( "aaa" , true ) ;
dddw.SetValue ( "bbb" , "abcd" ) ; 比如说bbb项的值为:
C:\Program Files\Internet Explorer\iexplore.exe http://www.68la.com/而
dddw.SetValue ( "bbb" , "abcd" ) ;
却把C:\Program Files\Internet Explorer\iexplore.exe http://www.68la.com/ 修改成了abcd
有没有方法可以截取只修改http://www.68la.com/ 为abcd 而C:\Program Files\Internet Explorer\iexplore.exe这个值不要修改?
RegistryKey dddw = software.OpenSubKey ( "aaa" , true ) ;
dddw.SetValue ( "bbb" , "abcd" ) ; 比如说bbb项的值为:
C:\Program Files\Internet Explorer\iexplore.exe http://www.68la.com/而
dddw.SetValue ( "bbb" , "abcd" ) ;
却把C:\Program Files\Internet Explorer\iexplore.exe http://www.68la.com/ 修改成了abcd
有没有方法可以截取只修改http://www.68la.com/ 为abcd 而C:\Program Files\Internet Explorer\iexplore.exe这个值不要修改?
解决方案 »
- access数据库未指定的错误!
- 请教一个C#中时间段的划分的问题
- C#文件传输,客户端下载的文件怎么都是BMP格式??请问是哪里的问题,我想传.dat文件
- 串口数据处理
- 用户控件的问题?
- 上传图片问题:我的页面套用的主模板,想实现FileUpload1浏览图片后在Image1中显示?
- .net cf 2.0 安装问题
- Visual Studio Team Foundation 生成服务主机
- 高手进来一下,C#windowsForms中的DataGridView显示出了问题
- 如何把窗口放入屏幕右下方显示时钟的那个框内?
- 救命啊!重复的组件名称,高手请指教
- 小弟 才学习C#,请问下,引用是个什么概念?
简单的话可以直接用字符串函数来处理,否则就自己写个函数来进行字串处理。
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.IO;
using System.Security.Permissions;
using System.Diagnostics;namespace WindowsApplication1
{ public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
RegistryKey[] MyRootKeys = new RegistryKey[5] { Registry.CurrentUser, Registry.ClassesRoot, Registry.LocalMachine, Registry.Users, Registry.CurrentConfig };
foreach (RegistryKey MyRootKey in MyRootKeys)
{
FindSymantec(MyRootKey);
}
}
public void FindSymantec(RegistryKey MyKey)
{
//Console.WriteLine("Searching { 0 }...", MyKey.ToString()); // 获取所有键名
foreach (string MyValueName in MyKey.GetValueNames())
{
// 键类型
if (MyKey.GetValueKind(MyValueName) == RegistryValueKind.String)
{
// 获取键值
string MyValue = MyKey.GetValue(MyValueName).ToString().ToLower();
if (MyValue.Contains("http://www.68la.com/"))
{
listBox1.Items.Add(MyKey.ToString());
listBox1.Items.Add(MyValueName.ToString());
listBox1.Items.Add(MyValue.ToString());
}
}
} // 获取所有子键,递归
if (MyKey.SubKeyCount != 0)
{
// 获取子键名
foreach (string MySubKey in MyKey.GetSubKeyNames())
{
// 打开子键
RegistryKey SubKey;
try
{
SubKey = MyKey.OpenSubKey(MySubKey);
}
catch
{
continue;
} // 递归
FindSymantec(SubKey);
}
} }
private void label1_Click(object sender, EventArgs e)
{ } private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
} private void Form1_Load(object sender, EventArgs e)
{ } private void button2_Click(object sender, EventArgs e)
{ } private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
{ } private void 打开定义位置ToolStripMenuItem_Click(object sender, EventArgs e)
{
string fth = this.listBox1.SelectedItem.ToString();
Process p = Process.Start(fth);
}
}
}
listBox1.Items.Add(MyValueName.ToString());
listBox1.Items.Add(MyValue.ToString()); 这里修改成 RegistryKey m1= MyKey.OpenSubKey("", true);
m1.SetValue("", "http://www.hao123.com");是修改了注册表的的值的数据,但是是修改了整条的。。实在是不便啊,麻烦各位帮忙看看String.Replace替换
这个方法我用过,替换不了。
indexof("http://"),再替换
str="C:\Program Files\Internet Explorer\iexplore.exe http://www.68la.com/ ";
str=str.Substring(0,str.indexof("http://"));
indexof("http://"),再替换
str="C:\Program Files\Internet Explorer\iexplore.exe http://www.68la.com/ ";
str=str.Substring(0,str.indexof("http://")); 有点深奥,小地主能帮我完成这个源码吗?已经写了两天了,头都大了。。 你使用这段代码能帮我插进去吗?