private void Regist_Load(object sender, EventArgs e) { MachineCode mc = new MachineCode(); //string a = mc.GetCpuInfo(); string b = mc.GetHDid(); //string c = mc.GetMoAddress(); string d = mc.GetCpuID(); //string ee = mc.GetHardDiskID(); //string f = mc.GetHostName(); string g = mc.GetMacAddress(); string machinecode = d + g; for (int i = 4; i < machinecode.Length; i += 5) { machinecode = machinecode.Insert(i, "-"); } textBox8.Text = machinecode; }
//标题菜单下拉的“获取机器码”点击 private void toolStripMenuItem3_Click(object sender, EventArgs e) { //string a = mc.GetCpuInfo(); string b = mc.GetHDid(); //string c = mc.GetMoAddress(); string d = mc.GetCpuID(); //string ee = mc.GetHardDiskID(); //string f = mc.GetHostName(); string g = mc.GetMacAddress(); string machinecode = d + g; for (int i = 4; i < machinecode.Length; i += 5) { machinecode = machinecode.Insert(i, "-"); } Clipboard.SetText(machinecode);//复制到剪切板 MessageBox.Show("本机机器码为:" + machinecode + "\t\r已经帮您复制,您可以直接在别处粘贴", "机器码", MessageBoxButtons.OK); }
private void Regist_Load(object sender, EventArgs e) { MachineCode mc = new MachineCode(); //string a = mc.GetCpuInfo(); string b = mc.GetHDid(); //string c = mc.GetMoAddress(); string d = mc.GetCpuID(); //string ee = mc.GetHardDiskID(); //string f = mc.GetHostName(); string g = mc.GetMacAddress(); string machinecode = d + g; for (int i = 4; i < machinecode.Length; i += 5) machinecode = machinecode.Insert(i, "-"); textBox8.Text = machinecode; }