VB.Net Tutorial/Windows/Network drive — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:56, 26 мая 2010

Connect to network drive

Imports System.Runtime.InteropServices
public class NetworkDriveConnectionDialog
      Const RESOURCETYPE_DISK As Short = 1
    
      Private Declare Function WNetConnectionDialog Lib "mpr.dll" (ByVal hwnd As Integer, ByVal dwType As Integer) As Integer

    Public Shared Sub Main
        WNetConnectionDialog(0, RESOURCETYPE_DISK)
    
    End Sub
End Class

Discocnnect the network drive

Imports System.Runtime.InteropServices
Public Class GetPrinterPort
      Const RESOURCETYPE_DISK As Short = 1
      Const RESOURCETYPE_PRINTER As Short = 2
    
      Private Declare Function WNetDisconnectDialog Lib "mpr.dll" (ByVal hwnd As Integer, ByVal dwType As Integer) As Integer

    Public Shared Sub Main
         Dim dwResult As Integer
        "Discocnnect the network drive {RESOURCETYPE_DISK = 1}
        dwResult = WNetDisconnectDialog(0, RESOURCETYPE_DISK)
    
    End Sub
End Class