Im trying to get my program to create a virtual drive just like the subst command. I don't really like the subst command, and I hate shelling. Better off using API I think.
Here is what I have worked out so far, but I still can't get it to work!
(I know im close!!!)
'Constants thanks to AlonHirsch!!!
Const DDD_EXACT_MATCH_ON_REMOVE As Long = &H4
Const DDD_NO_BROADCAST_SYSTEM As Long = &H8
Const DDD_RAW_TARGET_PATH As Long = &H1
Const DDD_REMOVE_DEFINITION As Long = &H2
Private Declare Function DefineDosDeviceW Lib "kernel32" (dwFlags As Long, DeviceName As Long, PathName As Long) As Boolean
Private Sub Command1_Click()
Dim namex As String
Dim namey As String
namex = "v"
namey = "c:\"
'make the virtual drive
MsgBox DefineDosDeviceW(DDD_RAW_TARGET_PATH, VarPtr(namex), VarPtr(namey))
'break the virtual drive
MsgBox DefineDosDeviceW(DDD_REMOVE_DEFINITION, VarPtr(namex), VarPtr(namey))
(yes, laugh at the newbie...)