代码如下:用注释的或者不注释的得出的都是 null或者键值不存在,为什么呢?注册表明明有的//string subNode = "HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\Word\\Addins\\WebPage.Connect\\LoadBehavior";
//Microsoft.Win32.RegistryKey rkey = null;
//rkey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(subNode, true);
//try
//{
// if (rkey != null)
// {
// rkey.SetValue("LoadBehavior", "3");
// }
// else
// {
// MessageBox.Show("null");
// }
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.ToString());
//}
RegistryKey key; //表示 Windows 注册表中的项级节点。此类是注册表封装。 key = Registry.CurrentUser.OpenSubKey("SoftWare\\Microsoft\\Internet Explorer\\Toolbar\\Explorer ", true); if (key == null)
{
MessageBox.Show("键不存在");
}
else
{
key.SetValue("backbitmap", "c:\\windows\\greenstone.bmp");
}
//Microsoft.Win32.RegistryKey rkey = null;
//rkey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(subNode, true);
//try
//{
// if (rkey != null)
// {
// rkey.SetValue("LoadBehavior", "3");
// }
// else
// {
// MessageBox.Show("null");
// }
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.ToString());
//}
RegistryKey key; //表示 Windows 注册表中的项级节点。此类是注册表封装。 key = Registry.CurrentUser.OpenSubKey("SoftWare\\Microsoft\\Internet Explorer\\Toolbar\\Explorer ", true); if (key == null)
{
MessageBox.Show("键不存在");
}
else
{
key.SetValue("backbitmap", "c:\\windows\\greenstone.bmp");
}
解决方案 »
- C# 实现模拟LED显示
- WinForm读取config文件问题
- 求 Visual Studio 2005 Team Suite 中文正式版下载地址?
- 新手问题:无法将类型“string”隐式转换为“int”
- 消息队列穿大量数据库数据 用什么格式比较好? 谢
- 请问:我运行一个C#的windows程序时有如下的错误提示,请问是哪里的问题啊,(急)
- 关于CurrencyManager 望高手指点迷津,急!分可以再加!
- wpf中如何让控件自动移动,从一个位置动画的移动到另一个地方!
- 谁可以给我一个用GDI+作图的例子,使我对这个东西有点印象?
- 很急!关于运行时间问题
- 现开发一个多数据库(Access、sql server、mysql、oracle)支持的web程序,希望大家能提供几个比较好的开发思路??
- 询问加载窗体背景的问题
"SoftWare\\Microsoft\\Internet Explorer\\Toolbar\\Explorer ":Explorer后有个空格。
看的够仔细
赞
// key = Registry.CurrentUser.OpenSubKey("SoftWare\\Microsoft\\Internet Explorer\\Toolbar\\Explorer", true);
key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Office\\Word\\Addins\\WebPage.Connect",true);
// key.SetValue("backbitmap", "c:\\windows\\greenstone.bmp");
key.SetValue("LoadBehavior", "0");