易截截图软件、单文件、免安装、纯绿色、仅160KB

c#简单操作注册表

一、首先先添加引用    using Microsoft.Win32;     
//因为操作注册表的两个类RegistryKey和Registry都包含在此引用中;
 
二、编写代码开始操作注册表
1、 #region      限制软件的使用次数
        private void BtnTimes_Click(object sender, EventArgs e)
        {
            try
            {
                 //在注册表中创建子键
                RegistryKey rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\Currentversion\\Run\\nums"); //CreateSubKey打开和创建两种功能
                int numscount = (int)rk.GetValue("nums", 0);        //读取注册表中软件使用次数
                if (numscount >= 10)
                {
                    MessageBox.Show("不好意思,你是非注册用户,只能免费使用十次,请注册!", "系统提示", MessageBoxButtons.OK,MessageBoxIcon.Warning);
                    rk.Close();       //关闭注册表
                    this.Close();    //退出程序
                }
 &n


相关文档:

C# 格式化输出XML

很多时候有一个xml字符串,没有换行,没有缩进,要生成xml文件不易阅读。下面的代码就是怎么将一个连续的xml字符串格式化输出
// a demo string
string xml = "<Root><Eles><Ele>abc</Ele><Ele>123</Ele></Eles></Root>";
System.Xml.XmlDocument doc = new System.Xml ......

C#使用SQLDMO实现对MSSQL数据库进行备份和恢复

public sealed class DbOper
{
     ///<summary>
     /// DbOper类的构造函数
     ///</summary>
     private DbOper()
     {
     }
     ......

C#开机自动启动应用程序

//命名空间 using Microsoft.Win32;
private void checkBox2_CheckedChanged(object sender, System.EventArgs e)
{
if (checkBox2.Checked) //设置开机自启动
{
//MessageBox.Show ("设置开机自启动需要修改注册表","提示");
string path = Application.ExecutablePath;
RegistryKey rk = Registry.LocalMac ......

C#自动关机源码

源码如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;
using Microsoft.Win32;
namespace mv
{ ......

C# 图片裁剪

/// <summary>
/// 缩小裁剪图片
/// </summary>
/// <param name="int_Width">要缩小裁剪图片宽度</param>
/// <param name="int_Height">要缩小裁剪图片长度</param>
/// <param name="input_ImgUrl">要处理图片路径< ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号