How would i go about mapping \\lab_techs\c\ when my program starts up? If possible assign it to letter T but if you just know how to map that directory it would be a big help thanks.
Printable View
How would i go about mapping \\lab_techs\c\ when my program starts up? If possible assign it to letter T but if you just know how to map that directory it would be a big help thanks.
This may help you. Create a new form and add 4 buttons. Here are the names and captions of the buttons:
Command1(0) - caption = "Connect Drive"
Command1(1) - caption = "Disconnect Drive"
Command1(2) - caption = "Quit
PrinterButton - caption = "End Capture"
Now add the code below -
Option Explicit
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
Const RESOURCETYPE_DISK = &H1, RESOURCETYPE_PRINT = 0
Private Sub Command1_Click(Index As Integer)
Dim x As Long
If Index = 0 Then 'Connect
x = WNetConnectionDialog(Me.hwnd, RESOURCETYPE_DISK)
ElseIf Index = 1 Then 'Disconnect
x = WNetDisconnectDialog(Me.hwnd, RESOURCETYPE_DISK)
Else
End
End If
End Sub
Private Sub PrinterButton_Click()
Dim x As Long
x = WNetDisconnectDialog(Me.hwnd, RESOURCETYPE_PRINT)
End Sub