oShell = createobject("Shell.Application"
oFolder = oShell.BrowseForFolder(0, "Select directory: ", 0 )
Declare INTEGER WNetAddConnection IN "mpr.dll" ;
STRING cRemoteName, ;
STRING cPassword, ;
STRING cLocalName
Do case
Case vartype(oFolder)="O"
If vartype(oFolder.Items.Item)="O"
If vartype(oFolder.Items.Item.path)="C"
cResource = oFolder.Items.Item.path
cPassword = ""
cDriveLetter = getNextDrive()+":"
if WNetAddConnection(cResource, cPassword,
cDriveLetter) =0
messagebox("Connection succesfull !!",0+64,"Confirm .."
else
messagebox("Unable to connect !!",0+16,"Confirm .."
endi
Endi
Endi
Endcase
Function getNextDrive()
For k=68 to 90
If driveType(chr(k))=1
Retu chr(k)
Endi
Endf
oFolder = oShell.BrowseForFolder(0, "Select directory: ", 0 )
Declare INTEGER WNetAddConnection IN "mpr.dll" ;
STRING cRemoteName, ;
STRING cPassword, ;
STRING cLocalName
Do case
Case vartype(oFolder)="O"
If vartype(oFolder.Items.Item)="O"
If vartype(oFolder.Items.Item.path)="C"
cResource = oFolder.Items.Item.path
cPassword = ""
cDriveLetter = getNextDrive()+":"
if WNetAddConnection(cResource, cPassword,
cDriveLetter) =0
messagebox("Connection succesfull !!",0+64,"Confirm .."
else
messagebox("Unable to connect !!",0+16,"Confirm .."
endi
Endi
Endi
Endcase
Function getNextDrive()
For k=68 to 90
If driveType(chr(k))=1
Retu chr(k)
Endi
Endf