如何映射/中断网络磁盘
【打印文章】
下面的程序段可以模拟【网上邻居】及【我的电脑】中的【映射 / 中断网络磁盘】,就是出现【映射 / 中断网络磁盘】的问话框,让使用者根据自己电脑的情形,来决定要连接的网络磁盘要映射到自己的那一个磁盘?要中断的又是那一个对应的磁盘?
请在声明区中加入以下声明及模组:
Private Declare Function WNetConnectionDialog Lib "mpr.dll" _
(ByVal hwnd As Long, ByVal dwType As Long) As Long
Private Declare Function WNetDisconnectDialog Lib "mpr.dll" _
(ByVal hwnd As Long, ByVal dwType As Long) As Long
Sub ShowMapDrives(hwnd As Long)
WNetConnectionDialog hwnd, 1
End Sub
Sub ShowUnMapDrives(hwnd As Long)
WNetDisconnectDialog hwnd, 1
End Sub
'程序中使用方式如下:
Private Sub Command1_Click()
'出现 映射网络磁盘 问话框
ShowMapDrives Me.hwnd
End Sub
Private Sub Command2_Click()
'出现 中断网络磁盘 问话框
ShowUnMapDrives Me.hwnd
End Sub
请在声明区中加入以下声明及模组:
Private Declare Function WNetConnectionDialog Lib "mpr.dll" _
(ByVal hwnd As Long, ByVal dwType As Long) As Long
Private Declare Function WNetDisconnectDialog Lib "mpr.dll" _
(ByVal hwnd As Long, ByVal dwType As Long) As Long
Sub ShowMapDrives(hwnd As Long)
WNetConnectionDialog hwnd, 1
End Sub
Sub ShowUnMapDrives(hwnd As Long)
WNetDisconnectDialog hwnd, 1
End Sub
'程序中使用方式如下:
Private Sub Command1_Click()
'出现 映射网络磁盘 问话框
ShowMapDrives Me.hwnd
End Sub
Private Sub Command2_Click()
'出现 中断网络磁盘 问话框
ShowUnMapDrives Me.hwnd
End Sub
本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )
【编程爱好者论坛】