VB关闭指定IP的网络连接
本人编了一个显示所有网络连接的程序,但无法获取进程名,在网上搜了好久都没搜到,求代码(要有注释和原理说明
工程.zip
(122.33 KB)
)
'给你一个 API 函数,功能是结束一个网络连接: Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long '另一个 API 函数,功能是结束一个枚举操作: Declare Function WNetCloseEnum Lib "mpr.dll" Alias "WNetCloseEnum" (ByVal hEnum As Long) As LongDeclare Function WNetCloseEnum Lib "mpr.dll" (ByVal hEnum As Long) As Long '再另一个 API 函数,功能是枚举网络资源: Declare Function WNetEnumResource Lib "mpr.dll" Alias "WNetEnumResourceA" (ByVal hEnum As Long, lpcCount As Long, lpBuffer As Any, lpBufferSize As Long) As Long Declare Function WNetEnumResource Lib "mpr.dll" Alias "WNetEnumResourceA" (ByVal hEnum As Long, lpcCount As Long, lpBuffer As NETRESOURCE, lpBufferSize As Long) As Long