Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping Network drives

Status
Not open for further replies.

paveway

Programmer
Jan 6, 1999
17
AU
G'Day, At work they want me to setup some old typing program to use on the new network. The program can only function when all of its data is in the right locations. Each user logs into the network with their assigned username (Train?? - where ?? = a number). The typing program expects h: drive to be a mapped drive which points to the data files for the particular trainee logged on. My problem is how do i (using code) map h: drive to a shared folder (the name depending on which login name was used)? For example, if the user login name is Train23, then I expect the mapping for h: drive to point to the shared name Train23. This is in a windows 98 environment, so i can't just use the NET command to do it. Thanks for any help.
 
As added extra info, in the registry HKEY_LOCAL_MACHINE -> Network -> Logon -> username = the username of the person logged on currently it think. So that solves part of the problem, at least now i know who is logged on and therefore which share to map h: drive onto. But the question is how to i get this value from the registry?
 
paveway,

I was searching tek-tips for the same answer you were looking for last January. Did you ever find out how to program a vc++ app to map a network drive?
 
Below is what I found on your problem:

- read from registry RegOpenKey/RegEnumKey (SDK functions) -#include windows.h.
- Read "Adhering to System Policy Settings" to find out more about network drive mapping on windows platforms
- WSH(Windows Scripting Host) has a function called MapNetworkDrive whick does exactly what you need. In order to use it I think you may use COM and have WSH enabled.

HTH,


s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top