Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running DOS Commands and Returning Result Codes?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00080871
Message ID:
00081028
Views:
28
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
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform