網上收集的C 獲取硬體資訊

2021-04-13 09:37:30 字數 1179 閱讀 7049

using system;

using system.runtime.interopservices;

using system.management;

namespace hardware

//取cpu編號

public string getcpuid()

return strcpuid;

}catch

}//end method

//取第一塊硬碟編號

public string getharddiskid()

return strharddiskid;

}catch

}//end

public enum ncbconst

[structlayout(layoutkind.sequential)]

public struct adapter_status

[structlayout(layoutkind.sequential)]

public struct name_buffer

[structlayout(layoutkind.sequential)]

public struct ncb

[structlayout(layoutkind.sequential)]

public struct lana_enum

[structlayout(layoutkind.auto)]

public struct astat

public class win32api

public string getmacaddress()

",adapter.adapt.adapter_address[0],

adapter.adapt.adapter_address[1],

adapter.adapt.adapter_address[2],

adapter.adapt.adapter_address[3],

adapter.adapt.adapter_address[4],

adapter.adapt.adapter_address[5]);}}

}catch

return addr.replace(' ', '0');}}

}貼自:http://www.e2web.cn/temp/0001/20066151522051349.htm

c 獲取硬體資訊

using system using system.runtime.interopservices using system.management namespace hardware 取cpu編號 public string getcpuid return strcpuid catch end m...

c 獲取硬體資訊

using system using system.runtime.interopservices using system.management namespace hardware 取cpu編號 public string getcpuid return strcpuid catch end m...

C 獲取硬體資訊

using system using system.net using system.runtime.interopservices using system.management 需要在解決方案中引用system.management.dll檔案 獲取機器名 public string getho...