Winforms注册码

Winforms注册码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Management;
namespace APP
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = GetDiskVolumeSerialNumber();
}
private void button2_Click(object sender, EventArgs e)
{
textBox2.Text = getCpu();
}
private void button3_Click(object sender, EventArgs e)
{
textBox3.Text = getMNum();
}
// 取得设备硬盘的卷标号
卷钉public static string GetDiskVolumeSerialNumber()
{
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid="c:""); disk.Get();
return disk.GetPropertyValue("VolumeSerialNumber").ToString();
}
//获得CPU的序列号
public static string getCpu()
{
string strCpu = null;
ManagementClass myCpu = new ManagementClass("win32_Processor"); ManagementObjectCollection myCpuConnection = myCpu.GetInstances();
foreach (ManagementObject myObject in myCpuConnection)
{
strCpu = myObject.Properties["Processorid"].Value.ToString();
break;
}
return strCpu;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////
namespace APP
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
绞车滚筒
/// <summary>
/
// 清理所有正在使⽤的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器⽣成的代码
/// <summary>
/// 设计器⽀持所需的⽅法 - 不要修改
/// 使⽤代码编辑器修改此⽅法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(393, 53);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "硬盘编号";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
/
/
// button2
//
this.button2.Location = new System.Drawing.Point(393, 117);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "CPU序列号";
光固化打印this.button2.Text = "CPU序列号";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);        //开关柜测温装置
/
/ textBox2
//
//
// button3
//
this.button3.Location = new System.Drawing.Point(393, 179);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 4;
this.button3.Text = "⽣成机器码";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);        //
// textBox3
//取根
/
/
// button4
//
this.button4.Location = new System.Drawing.Point(393, 231);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 6;
网眼通this.button4.Text = "⽣成注册码";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);        //
// textBox4
/
/
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;        this.ClientSize = new System.Drawing.Size(498, 291);
this.Controls.Box4);
this.Controls.Add(this.button4);
this.Controls.Box3);
this.Controls.Add(this.button3);
this.Controls.Box2);
this.Controls.Add(this.button2);
this.Controls.Box1);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "注册码";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button4;

本文发布于:2024-09-20 17:46:19,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/4/105053.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:设计   硬盘   设备   释放   编辑器   获得   绞车   打印
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议