c 獲取硬體資訊

2021-04-13 23:40:52 字數 1304 閱讀 4768

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'

);}}}

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...

C 獲取硬體資訊

using system using system.net using system.runtime.interopservices using system.management 需要在解決方案中引用system.management.dll檔案 hardinfoclass 的摘要說明。publi...