|Using the Get
Volume API tip previously posted on PBDR will return the names of
the drives connected to your machine. Unfortunately for network drives
this returns the name of the physical drive not the name of the share
you have mapped to. If you have many shares mapped to a single physical
network drive you will not be able to distinguish between the drives.
To improve this situation you can use an API call to return the name
of the network share. This is more meaningful and easier for the user.
The API call you will need to use is WNetGetConnectionA. To use the API
call declare the local external function as follows:
function ulong WNetGetConnectionA( string szLocalPath, &
ref string szNameBuffer, ref ulong lpBufferSize) Library "mpr"
Then in your script you can call the API as follows:
String ls_Drive, ls_Volume
// hard coded for the f: drive
ls_Drive = 'f:'
lul_Max = 2000
// pre allocate string to stop GPF
ls_Volume = Space( 2000 )
// call the API function, the share name
// will be in the ls_Volume variable
ll_RC = WNetGetConnectionA( ls_Drive, ls_Volume, lul_Max )
ls_Volume = Trim( ls_Volume )