/// 获取网卡硬件地址
/// </summary>
/// <returns> string </returns>
//using SystemManagement;
public string GetMoAddress()
{
string MoAddress = " ";
using (ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"))
{
ManagementObjectCollection moc2 = mcGetInstances();
foreach (ManagementObject mo in moc2)
{
if ((bool)mo["IPEnabled"] == true)
MoAddress = mo["MacAddress"]ToString();
moDispose();
}
}
return MoAddressToString();
} 1,获取CPU编号
SystemManagementManagementClass mc = new ManagementClass("win32_processor");
ManagementObjectCollection moc = mcGetInstances();
foreach (ManagementObject mo in moc)
{
MessageBoxShow(mo["processorid"]ToString());
}
2,获取主板ID
SystemManagementManagementObjectSearcher searcher = new SystemManagementManagementObjectSearcher("SELECT FROM Win32_PhysicalMedia");
foreach (ManagementObject mo in searcherGet())
{
MessageBoxShow( mo["SerialNumber"]ToString()Trim());
}
或者:
SystemManagementManagementClass mc = new SystemManagementManagementClass("Win32_BaseBoard");
ManagementObjectCollection moc = mcGetInstances();
foreach (ManagementObject mx in moc)
{
MessageBoxShow( mxProperties["SerialNumber"]ValueToString());
}
3,获取硬盘ID
SystemManagementManagementClass mc = new SystemManagementManagementClass("Win32_DiskDrive");
ManagementObjectCollection moc = mcGetInstances();
foreach (ManagementObject mo in moc)
{
MessageBoxShow(moProperties["Model"]ValueToString());
}
4,获取网卡地址
SystemManagementManagementClass mc = new SystemManagementManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mcGetInstances();
foreach (ManagementObject mo in moc)
{
if((bool)mo["IPEnabled"] == true)
MessageBoxShow(mo["MacAddress"]ToString());
moDispose();
}
5,获取内存信息
SystemManagementManagementClass mcMemory = new SystemManagementManagementClass("Win32_OperatingSystem");
ManagementObjectCollection mocMemory = mcMemoryGetInstances();
foreach (ManagementObject mo in mocMemory)
{
if (moProperties["TotalVisibleMemorySize"]Value != null)
{
MessageBoxShow(moProperties["TotalVisibleMemorySize"]ValueToString());
}
}UUID uuid=UUIDrandomUUID();
Systemoutprintln(uuidtoString());
UUID含义是通用唯一识别码 (Universally Unique Identifier),这 是一个软件建构的标准,也是被开源软件基金会 (Open Software Foundation, OSF) 的组织应用在分布式计算环境 (Distributed Computing Environment, DCE) 领域的一部分。您好
Intel官网有个关于 CPUID指令的描述文档可以看下。
只不过是汇编的。
但是可以用vc嵌入汇编写出来, 然后P/INVOKE过来。
希望回答对您有所帮助
需要准备的材料分别是:电脑、php编辑器、浏览器。
1、首先,打开php编辑器,新建php文件,例如:indexphp。
2、在indexphp中,输入代码:echo $_SERVER['REMOTE_ADDR'];。
3、浏览器运行indexphp页面,此时会打印出用户的远程地址。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)