解决方案 »

  1.   

    if( DateTime.Now>Convert.ToDateTime("2013-04-30"))
     MessageBox.Show("试用版已过期");
    else
     正常运行;
      

  2.   

    安装时取internet时间保存,加密写文件然后每次运行时取internet时间对比,如果超过规定时间则程序退出,提示过期
      

  3.   


     #region 注册此软件
                this.btnReg.Visible = true;            this.Text = "此软件尚未注册!";
                this.btnReg.Enabled = true;
                MessageBox.Show("您现在使用的是试用版,可以免费试用10次!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Int32 tLong;
                try
                {
                    tLong = (Int32)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\SoftUse", "UseTimes", 0);
                    MessageBox.Show("您已经使用了" + tLong + "次!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch
                {
                    MessageBox.Show("欢迎使用本软件!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\SoftUse", "UseTimes", 0, RegistryValueKind.DWord);
                }
                tLong = (Int32)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\SoftUse", "UseTimes", 0);
                if (tLong < 10)
                {
                    int tTimes = tLong + 1;
                    Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\SoftUse", "UseTimes", tTimes);
                }
                else
                {
                    DialogResult result = MessageBox.Show("此软件的试用次数已到!您是否需要注册?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        FrmRegister.state = false;
                        btnReg_Click(sender, e);
                    }
                    else
                    {
                        Application.Exit();
                    }
                } 
                #endregion
    注册:RegistryKey retkey = Registry.CurrentUser.OpenSubKey("Software", true).CreateSubKey("自定义一个名称").CreateSubKey("自定义一个名称.INI").CreateSubKey(txtRNum.Text);
                        retkey.SetValue("UserName", "Rsoft");
    登录的时候: //判断软件是否注册RegistryKey retkey = Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("自定义一个名称").CreateSubKey("自定义一个名称.INI");
                foreach (string strRNum in retkey.GetSubKeyNames())
                {
    //这里做判断
    }
      

  4.   

    安装的时候把系统时间写入注册表,每次登陆的时候对比下当前时间和注册表时间看过了试用期限么,然后
    if else
      

  5.   

    把2个时间写入注册表,安装时间和最后使用时间。
    安装的时候,把安装时间写入注册表。
    每次使用的时候,判断一下当前时间,如果(当前时间>安装时间+试用时间) 或者 (当前时间 < 安装时间)
    就提示到期。
     
      

  6.   

    http://blog.csdn.net/zb872676223/article/details/17416825