PDA

View Full Version : UNC path?



timelox
11-01-2002, 06:02 AM
Are there any built-in functions in Developer 8 that I could use in my script to translate a mapped path to full unc path?

In my script I let the user select where to store a database. The path the user selects is used when installing the ODBC Resources. The script is also installing a NT Service that is using the DSN but since the service is running without anyone being logged on there are no mapped drives. So...I must translate the path the user selected into a full network path.

Please help.
/Magnus

LewisQ
11-01-2002, 07:34 AM
THis should help you:



prototype Mpr.WNetGetConnectionA(byref string, byref string, byref long);

// FUNCTION: UNCFromMappedDrive
//
// PURPOSE: Uses systrem calls to retrieve a UNC for a drive letter
//
// PARAMS: sLocalName - "Letter:"
// sRemote - Returned (by ref) UNC
//
// RETURNS: Always returns 0
//
// REMARKS: GetUNCPath("Letter:", sVar);

function UNCFromMappedDrive(sLocalName, sRemote)
long lBufferSize;
string sUNC[MAX_PATH + 1];
begin
UseDLL("MPR.dll");
lBufferSize = MAX_PATH + 1;
WNetGetConnectionA(sLocalName, sUNC, lBufferSize);
sRemote = sUNC;
UnUseDLL("MPR.dll");
end;