How to map/break network disks

Source: Internet
Author: User

The following program segment simulates mapping/interrupting network disks in My Network Places and my computer. is the "Map/Interrupt Network Disk" question box, so that users according to their own computer situation, to determine the network disk to be connected to map to their own disk? Which one is the corresponding disk to interrupt?

Please add the following declaration and module to the declaration area:

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.