通过访问硬盘序列号保护软件 [英] To protect software by accessing harddisk serial no

查看:150
本文介绍了通过访问硬盘序列号保护软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动程序时,我想获取VB.NET或VB代码以访问硬盘序列号.这是为了帮助我保护自己的软件免受试图盗版的人的侵害.

I want to get the VB.NET or VB code to access the hard disk serial no when starting the program. It's to help me to protect my own software from people who try to pirate copies.

推荐答案

在c#中,但是您明白了.您将为此使用System.Management:

In c#, but you get the idea. You'll want to use System.Management for this:

string driveLetter = Environment.SystemDirectory.Substring(0, 2);
string sn = new System.Management.ManagementObject("Win32_LogicalDisk.DeviceID=\"" + driveLetter + "\"").GetPropertyValue("VolumeSerialNumber").ToString();

正如其他人指出的那样,这可能不是解决此问题的最佳方法.但是,那是你的事.

As others have pointed out, this might not be the best way to handle this. However, that's your business.

这篇关于通过访问硬盘序列号保护软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆