zoukankan      html  css  js  c++  java
  • 进入Windows之前发出警告

    实现效果:

      

    知识运用:

      通过注册表中HKLM:SOFTWAREMicrosoftWindows NTCurrentVersionWinlogon子键下的LegalNoticeCaptionLegalNoticeText项的值

    来实现

    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(@"SOFTWAREMicrosoftWindows NTCurrentVersionWinlogon");  //创建注册表项
                rinfo.SetValue("LegalNoticeCaption",textBox1.Text,RegistryValueKind.String);                    //设置键
                rinfo.SetValue("LegalNoticeText",textBox2.Text,RegistryValueKind.String);                       //设置值
                MessageBox.Show("设置成功!请重新启动","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
    

      

  • 相关阅读:
    javascript变量
    javascript数据类型
    javascript基本语法
    javascript用法
    javascript简介
    js 随机生成颜色值
    JS 判断传入的变量类型是否是Array
    swiper2 swiper-slide 之间的间距调整
    IE9以及以下不支持jquery ajax跨域问题
    HBuilder只提示html 不提示js
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10302178.html
Copyright © 2011-2022 走看看