• 大小: 98KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-06
  • 语言: C#
  • 标签: 软件注册  

资源简介

压缩包中有两个项目:SoftRegister为软件实现注册的演示; SoftwarePassport为注册机的演示。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace SoftRegister
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        SoftReg softReg = new SoftReg();

        private void FormMain_Load(object sender EventArgs e)
        {
            //判断软件是否注册
            RegistryKey retkey = Registry.CurrentUser.OpenSubKey(“SOFTWARE“ true).CreateSubKey(“WifiCreat“).CreateSubKey(“Register.INI“);
            foreach (string strRNum in retkey.GetSubKeyNames())
            {
                if (strRNum == softReg.GetRNum())
                {
                    this.labRegInfo.Text = “此软件已注册!“;
                    this.btnReg.Enabled = false;
                    return;
                }
            }
            this.labRegInfo.Text = “此软件尚未注册!“;
            this.btnReg.Enabled = true;
            MessageBox.Show(“您现在使用的是试用版,可以免费试用30次!“ “信息“ MessageBoxButtons.OK MessageBoxIcon.Information);
            
            Int32 tLong;    //已使用次数
            try
            {
                tLong = (Int32)Registry.GetValue(“HKEY_LOCAL_MACHINE\\SOFTWARE\\WifiCreat“ “UseTimes“ 0);
                MessageBox.Show(“您已经使用了“ + tLong + “次!“ “信息“ MessageBoxButtons.OK MessageBoxIcon.Information);
            }
            catch
            {
                MessageBox.Show(“欢迎使用本软件!“ “信息“ MessageBoxButtons.OK MessageBoxIcon.Information);
                Registry.SetValue(“HKEY_LOCAL_MACHINE\\SOFTWARE\\WifiCreat“ “UseTimes“ 0 RegistryValueKind.DWord);
            }

            //判断是否可以继续试用
            tLong = (Int32)Registry.GetValue(“HKEY_LOCAL_MACHINE\\SOFTWARE\\WifiCreat“ “UseTimes“ 0);
            if (tLong < 30)
            {
                int tTimes = tLong + 1;
                Registry.SetValue(“HKEY_LOCAL_MACHINE\\SOFTWARE\\WifiCreat“ “UseTimes“ tTimes);
            }
            else
            {
                DialogResult result = MessageBox.Show(“试用次数已到!您是否需要注册?“ “信息“ MessageBoxButtons.YesNo MessageBoxIcon.Information);
                if (result == DialogResult.Yes)
                {
                    FormRegister.state = false; //设置软件状态为不可用
                    btnReg_Click(sender e);    //打开注册窗口
                }
                else
                {
                    Application.Exit();
                }
            }

        }

        private void btnClose_Click(object sender EventArgs e)
        {
            Application.Exit();
        }

        private void btnReg_Click(object sender EventArgs e)
        {
            FormRegister frmRegister = new FormRegister();
            frmRegister.ShowDialog();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-01-04 13:05  SoftRegister\
     目录           0  2013-01-04 08:41  SoftRegister\bin\
     目录           0  2013-01-04 09:33  SoftRegister\bin\Debug\
     文件       13824  2013-01-04 13:05  SoftRegister\bin\Debug\SoftRegister.exe
     文件       36352  2013-01-04 13:05  SoftRegister\bin\Debug\SoftRegister.pdb
     文件       14328  2013-01-04 09:33  SoftRegister\bin\Debug\SoftRegister.vshost.exe
     文件        3154  2013-01-04 10:27  SoftRegister\FormMain.cs
     文件        3336  2013-01-04 09:38  SoftRegister\FormMain.Designer.cs
     文件        5814  2013-01-04 09:38  SoftRegister\FormMain.resx
     文件        1911  2013-01-04 13:05  SoftRegister\FormRegister.cs
     文件        4799  2013-01-04 13:05  SoftRegister\FormRegister.Designer.cs
     文件        5814  2013-01-04 13:05  SoftRegister\FormRegister.resx
     目录           0  2013-01-04 08:41  SoftRegister\obj\
     目录           0  2013-01-04 13:05  SoftRegister\obj\Debug\
     目录           0  2013-01-04 08:41  SoftRegister\obj\Debug\Refactor\
     文件         596  2013-01-04 13:03  SoftRegister\obj\Debug\SoftRegister.csproj.FileListAbsolute.txt
     文件         915  2013-01-04 13:05  SoftRegister\obj\Debug\SoftRegister.csproj.GenerateResource.Cache
     文件       13824  2013-01-04 13:05  SoftRegister\obj\Debug\SoftRegister.exe
     文件         180  2013-01-04 09:38  SoftRegister\obj\Debug\SoftRegister.FormMain.resources
     文件         180  2013-01-04 13:05  SoftRegister\obj\Debug\SoftRegister.FormRegister.resources
     文件       36352  2013-01-04 13:05  SoftRegister\obj\Debug\SoftRegister.pdb
     文件         180  2013-01-04 09:33  SoftRegister\obj\Debug\SoftRegister.Properties.Resources.resources
     目录           0  2013-01-04 08:41  SoftRegister\obj\Debug\TempPE\
     文件         496  2013-01-04 08:41  SoftRegister\Program.cs
     目录           0  2013-01-04 08:41  SoftRegister\Properties\
     文件        1366  2013-01-04 08:41  SoftRegister\Properties\AssemblyInfo.cs
     文件        2874  2013-01-04 08:41  SoftRegister\Properties\Resources.Designer.cs
     文件        5612  2013-01-04 08:41  SoftRegister\Properties\Resources.resx
     文件        1097  2013-01-04 08:41  SoftRegister\Properties\Settings.Designer.cs
     文件         249  2013-01-04 08:41  SoftRegister\Properties\Settings.settings
     文件        3460  2013-01-04 09:32  SoftRegister\SoftReg.cs
............此处省略34个文件信息

评论

共有 条评论