From: Fred Taylor (ftaylor@mvps.org) Subject: Re: Map network drive ?? View this article only Newsgroups: microsoft.public.fox.programmer.exchange Date: 2001-01-22 12:56:19 PST DECLARE INTEGER WNetAddConnection IN "mpr.dll" ; STRING cRemoteName, ; STRING cPassword, ; STRING cLocalName cResource = "\\Server\ShareName" cPassword = "MyPassword" cDriveLetter = "Y:" ? WNetAddConnection(cResource, cPassword, cDriveLetter) cResource = "\\Server\AnotherShare" cPassword = chr(0) && important distinction from the original (no password) cDriveLetter = "Q:" lnRetval = WNetAddConnection(cResource, cPassword, cDriveLetter) ?lnRetVal A return of 0 means the connection was made. You get a non-zero value for a failure to add a new connection. I got an 85 for a connection that already exists, and a 67 for one that failed. -- Fred Microsoft Visual FoxPro MVP Please respond only to the newsgroups so that all may benefit.one more
From: William Fields (Bill_Fields@azb.uscourts.gov) Subject: Re: Map network drive ?? View this article only Newsgroups: microsoft.public.fox.programmer.exchange Date: 2001-01-22 16:30:07 PST If you have access to the Windows Scripting Host you can do the following oNet = CreateObject("Wscript.Network") oFSO = CreateObject("Scripting.FileSystemObject") If oFSO.DriveExists("ShareName") oNet.MapNetworkDrive("DriveLetter:", "ShareName") MessageBox("Drive DriveLetter mapped to ShareName",0,"Drive mapped") Else MessageBox("ShareName cannot be found",0,"Drive NOT mapped") EndIf -- William Fields MCSD - Microsoft Visual FoxPro MCP - Win2k Pro US Bankruptcy Court Phoenix, AZ