You might want to try using a Win32 API call to do the work for you - the
interactive dialog for printer connection can be accessed using
WNetConnectionDialog() as follows:
DECLARE INTEGER GetActiveWindow IN Win32API
DECLARE INTEGER WNetConnectionDialog IN Win32API ;
INTEGER nWindowHandle, ;
INTEGER nDialogType
nResult = WNetConnectionDialog(GetActiveWindow(),2)
There is an equivalent call to map a drive interactively using
WNetConnectionDialog() with a second argument of 1; non-interactive
resource mapping is also supported with one of the WNet family of API calls,
but I don't remember which one it is off the top of my head. This works
with 95 and NT, with virtually any NOS; there are some peculiarities with
mapping drives and print queues under NetWare using the WNet family calls,
but they're easy enough to handle.
If you need some further examples, I have an API class that includes methods
for both printer and drive mapping; it isn't formally documented beyond
internal commenting, but it works and is pretty reliable. Drop me a line at
edrauh@pcnet.com if you want a copy to play with.
Ed Rauh