进入Windows之前发出警告
2024-08-29 18:11:55
实现效果:
知识运用:
通过注册表中HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\子键下的LegalNoticeCaption和LegalNoticeText项的值
来实现
RegistryKey类的CreateSubKey SetValue方法
public RegistryKey CreateSubKey (string subkey) //创建一个或打开一个子项进行写访问
//使用指定的注册表数据类型设置注册表中的名称/值对的值
//name:存储的值名称 value:存储的数据 valueKind:存储是使用的注册表数据类型
public void SetValue (string name ,Object value ,RegistryValueKind valueKind)
补:使用RegistryKey和Registry类时 引用 Microsoft. Win32
实现代码:
private void button1_Click(object sender, EventArgs e)
{
RegistryKey rkey = Registry.LocalMachine; //获取注册表中的LocalMachine节点
RegistryKey rinfo = rkey.CreateSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"); //创建注册表项
rinfo.SetValue("LegalNoticeCaption",textBox1.Text,RegistryValueKind.String); //设置键
rinfo.SetValue("LegalNoticeText",textBox2.Text,RegistryValueKind.String); //设置值
MessageBox.Show("设置成功!请重新启动","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
最新文章
- python gutter area / 设置断点、行号右边代码左边的空白栏
- clang编译mysql(Ubuntu10 64位)
- Android中ListView 控件与 Adapter 适配器如何使用?
- 数据结构 《5》----二叉搜索树 ( Binary Search Tree )
- Project Euler 108:Diophantine reciprocals I 丢番图倒数I
- 时间处理总结(一).net
- Apple-Watch开发2 APPIcon设置
- list、dict、tuple的一些小操作总结
- Intel为什么做不好手机CPU?
- C++类对象大小的计算
- php SESSION入库的实现
- Map集合转成json数据
- socket的阻塞与非阻塞,同步与异步
- flask使用基础
- Houdini技术体系大纲
- private static final long serialVersionUID = 1L这句话到底什么意思?
- JVM(3)对象A和B循环引用,最后会不会不被GC回收?-------关于Java的GC机制
- url后面添加参数,注意&;?的添加方式
- iOS 开发笔记-Storyboard
- 机器学习--boosting家族之Adaboost算法