vb获取网卡mac的完整代码VB获取网卡MAC地址源代码
具体代码:(其中GetMACAddress() 函数为楼主所需函数)
Option Explicit
Public CheckCode As Long
Private Const NCBASTATAs Long = H33
Private Const NCBNAMSZAs Integer = 16
Private Const HEAP_ZERO_MEMORYAs Long = H8
Private Const HEAP_GENERATE_EXCEPTIONSAs Long = H4
Private Const NCBRESETAs Long = H32
Private Type NCB
ncb_commandAs Byte
ncb_retcodeAs Byte
ncb_lsnAs Byte
ncb_numAs Byte
ncb_bufferAs Long
ncb_lengthAs Integer
ncb_callnameAs String * NCBNAMSZ
ncb_nameAs String * NCBNAMSZ
ncb_rtoAs Byte
ncb_stoAs Byte
ncb_postAs Long
ncb_lana_numAs Byte
ncb_cmd_cpltAs Byte
ncb_reserve(9)As Byte
ncb_eventAs Long
End Type
Private Type ADAPTER_STATUS
adapter_address(5)As Byte
rev_majorAs Byte
reserved0As Byte
adapter_typeAs Byte
rev_minorAs Byte
durationAs Integer
frmr_recvAs Integer
frmr_xmitAs Integer
iframe_recv_errAs Integer
xmit_abortsAs Integer
xmit_successAs Long
recv_successAs Long
iframe_xmit_errAs Integer
recv_buff_unavailAs Integer
t1_timeoutsAs Integer
ti_timeoutsAs Integer
Reserved1As Long
free_ncbsAs Integer
max_cfg_ncbsAs Integer
max_ncbsAs Integer
xmit_buf_unavailAs Integer
max_dgram_sizeAs Integer
pending_sessAs Integer
max_cfg_sessAs Integer
max_sessAs Integer
max_sess_pkt_sizeAs Integer
name_countAs Integer
End Type
Private Type NAME_BUFFER
nameAs String * NCBNAMSZ
name_numAs Integer
name_flagsAs Integer
End Type
Private Type ASTAT
adaptAs ADAPTER_STATUS
NameBuff(30)As NAME_BUFFER
End Type
Private Declare Function Netbios Lib "netapi32.dll" (pncb As NCB) As Byte
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, _
ByVal hpvSource As Long, _
ByVal cbCopy As Long)
Private Declare Function GetProcessHeap Lib "kernel32" () As Long
Private Declare Function HeapAlloc Lib "kernel32" (ByVal hHeap As Long, _
ByVal dwFlags As Long, _
ByVal dwBytes As Long) As Long
Private Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, _
ByVal dwFlags As Long, _
lpMem As Any) As Long
Public Function GetMAC() As Integer
Dim bRetAs Byte
Dim myNcbAs NCB
Dim myASTAT As ASTAT
Dim pASTATAs Long
Dim intMAC As Integer
myNcb.ncb_command = NCBRESET
bRet = Netbios(myNcb)
With myNcb
.ncb_command = NCBASTAT
.ncb_lana_num = 0
.ncb_callname = "* "
.ncb_length = Len(myASTAT)
pASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS Or HEAP_ZERO_MEMORY, .ncb_length)
End With
【vb.net获取电脑配置 vbnet获取当前目录下文件名】If pASTAT = 0 Then
Exit Function
End If
myNcb.ncb_buffer = pASTAT
bRet = Netbios(myNcb)
CopyMemory myASTAT, myNcb.ncb_buffer, Len(myASTAT)
intMAC = myASTAT.adapt.adapter_address(0)
intMAC = intMACmyASTAT.adapt.adapter_address(1)
intMAC = intMACmyASTAT.adapt.adapter_address(2)
intMAC = intMACmyASTAT.adapt.adapter_address(3)
intMAC = intMACmyASTAT.adapt.adapter_address(4)
intMAC = intMACmyASTAT.adapt.adapter_address(5)
GetMAC = intMAC
Call HeapFree(GetProcessHeap(), 0, pASTAT)
End Function
Public Function GetMACAddress() As String
Dim bRetAs Byte
Dim myNcbAs NCB
Dim myASTAT As ASTAT
Dim pASTATAs Long
myNcb.ncb_command = NCBRESET
bRet = Netbios(myNcb)
With myNcb
.ncb_command = NCBASTAT
.ncb_lana_num = 0
.ncb_callname = "* "
.ncb_length = Len(myASTAT)
pASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS Or HEAP_ZERO_MEMORY, .ncb_length)
End With
If pASTAT = 0 Then
Exit Function
End If
myNcb.ncb_buffer = pASTAT
bRet = Netbios(myNcb)
CopyMemory myASTAT, myNcb.ncb_buffer, Len(myASTAT)
GetMACAddress = HexEx(myASTAT.adapt.adapter_address(0))"-"HexEx(myASTAT.adapt.adapter_address(1))"-"HexEx(myASTAT.adapt.adapter_address(2))"-"HexEx(myASTAT.adapt.adapter_address(3))"-"HexEx(myASTAT.adapt.adapter_address(4))"-"HexEx(myASTAT.adapt.adapter_address(5))
Call HeapFree(GetProcessHeap(), 0, pASTAT)
End Function
Private Function HexEx(ByVal B As Long) As String
Dim aa As String
aa = Hex$(B)
If Len(aa)2 Then
aa = "0"aa
End If
HexEx = aa
End Function
自己用VB.NET写了一个软件,出现了一个BUG,界面最小化后点不开,多点几次就能打开,求指教 。电脑配置好你的控件里是不是用了多线程?可能是线程与线程之间没有协调好 。你可以试一试用Sleep 。
如何使用VB.NET编程取得电脑硬体配置(规格与型号)清单,如CPU & 主板 & 内存 & 硬盘...做数字编程vb.net获取电脑配置的电脑比做图形编程的电脑配置要求要低的多vb.net获取电脑配置,只要内存够大就可以vb.net获取电脑配置 , 集成显卡的都能跑 。如果对显示器没要求(不是必须要LCD的,为眼睛考虑,那么买600块的17寸CRT的),整个配置1800都拿的下来 。
如要配置单,请楼主回 。
去下载一个EVEREST,这个就是一款硬件识别软件,然后你用C语言或其vb.net获取电脑配置他的编程工具将它拆开,你不就知道,那玩意是怎么编出来的vb.net获取电脑配置了吗 。
解释一下 .net 、VS、VC 和vb.net的开发环境...谢谢!1. .net是微软的语言架构,是面向对象的托管语言;VS是Visual Studio的缩写,是微软的集成开发环境,通过它可以设计 , 开发和调试微软平台的程序,其中包括.net , 也包括不是.net的程序;VC是Visual C的缩写,是微软版本的C语言,用来开发桌面应用,不能做网站;VB.NET是.net中的一种语言,和原来的VB完全不同 , 可以用来开发桌面和网站,VB.net的开发环境是VS.net(目前最高版本是vs2008) 。
2. 做网站的话 , 需要安装VS(建议VS2008,因为更加强大) , 如果用SQL Server的话需要安装SQL Server(建议SQL2008,因为性能更好) 。
3. VS2005和VS2008大小差不多,完全安装4G左右 , 最小安装1G左右
4. 如果使用数据库建议用2008因为2000马上就要停止技术支持了 。
关于vb.net获取电脑配置和vbnet获取当前目录下文件名的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。
推荐阅读
- 如何推广自己品牌的衣服,如何推广自己品牌的衣服店铺
- vb.net打开选择文件,vb点击按钮弹出文件选择框
- jquery获得根路径,jquery获取路径参数
- springgo语言 springboot go语言
- 视频号的关注怎么找到他,视频号的关注怎么找到他呢
- excel表格怎么乘除,excel表格怎么乘除加减
- 直播塑造衣服品质话术文案,直播塑造衣服品质话术文案怎么写
- mysql中空格怎么表示 mysql char 空格
- 故宫用什么拍摄,故宫最佳拍摄角度