VB获取网卡硬件信息

来源:百度知道 编辑:UC知道 时间:2024/04/29 17:18:07
VB 如何通过API获取网卡的硬件信息,比如:
我的网卡为:
Atheros L1 Gigabit Ethernet 10/100/1000Base-T Controller
如何通过这个网卡名获得像下面这个样的信息
\Device\Tcpip_{113F8C45-C710-4CA4-9745-A6AA9339F057}
我只要{}中的值
然后在注册表中读取这个子键中的内容,来判断该网卡是不是物理网卡

如果只是为了知道本机是否联网那只需要发一个消息到一个网站,如果有回应就说明联网了的,如果获取网卡地址那
1)在Visual Basic生成标准的EXE文件。缺省创建 Form1。 iQMitug
2)在Form1中添加一命令按钮,缺省名为Command1。 iQMitug
3)把下列代码放到Form1中说明部分。

Option Explicit iQMitug
Private Const NCBASTAT = &H33 iQMitug
Private Const NCBNAMSZ = 16 iQMitug
Private Const HEAP_ZERO_MEMORY = &H8 iQMitug
Private Const HEAP_GENERATE_EXCEPTIONS = &H4 iQMitug
Private Const NCBRESET = &H32 iQMitug
Private Type NCB

ncb_command As Byte 'Integer

ncb_retcode As Byte 'Integer

ncb_lsn As Byte 'Integer

ncb_num As Byte ' Integer

ncb_buffer As Long 'String

ncb_length As Integer

ncb_callname As String * NCBNAMSZ

ncb_name As String * NCBNAMSZ

ncb_rto As Byte 'Integer

ncb_sto As Byte ' Integer

ncb_post As Long

ncb_lana_num As Byte 'Integer