資源簡介
壓縮包中有兩個項目:SoftRegister為軟件實現(xiàn)注冊的演示;
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(“您現(xiàn)在使用的是試用版,可以免費試用30次!“?“信息“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????
????????????Int32?tLong;????//已使用次數(shù)
????????????try
????????????{
????????????????tLong?=?(Int32)Registry.GetValue(“HKEY_LOCAL_MACHINE\\SOFTWARE\\WifiCreat“?“UseTimes“?0);
????????????????MessageBox.Show(“您已經(jīng)使用了“?+?tLong?+?“次!“?“信息“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????}
????????????catch
????????????{
????????????????MessageBox.Show(“歡迎使用本軟件!“?“信息“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????????Registry.SetValue(“HKEY_LOCAL_MACHINE\\SOFTWARE\\WifiCreat“?“UseTimes“?0?RegistryValueKind.DWord);
????????????}
????????????//判斷是否可以繼續(xù)試用
????????????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(“試用次數(shù)已到!您是否需要注冊?“?“信息“?MessageBoxButtons.YesNo?MessageBoxIcon.Information);
????????????????if?(result?==?DialogResult.Yes)
????????????????{
????????????????????FormRegister.state?=?false;?//設(shè)置軟件狀態(tài)為不可用
????????????????????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個文件信息
- 上一篇:c# 圖片編輯方法集合
- 下一篇:c# 調(diào)用百度地圖API
評論
共有 條評論