VB得到网卡信息

来源:百度知道 编辑:UC知道 时间:2024/05/15 17:36:48
我想用VB得到网卡的信息

我说的不是IP,网关之类的

我想得到网卡的状态,比如网线被拔出之类的

如果只是为了知道本机是否联网那只需要发一个消息到一个网站,如果有回应就说明联网了的,如果获取网卡地址那
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