Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Values Returned by Win32API With WNetAddConnection
Message
From
17/12/2000 04:30:01
 
 
To
15/12/2000 19:10:13
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00454296
Message ID:
00454471
Views:
35
>What mean those values Returned by Win32API when I execute WNetAddConnection ?
>
>Declare integer WNetAddConnection in WIN32API string,string,string
>drive_letter = "G:"
>share_name = "\\boss500\"

The format of a share is \\MachineName\ShareName - you've omitted the sharename, so the WNetAddConnection() will inherently fail. You need to specify both parts of the UNC.

BTW, WNetAddConnction() is for backwards comaptibility to Win16; I'd strongly suggest using WNetAddConnection2() or WNetAddConnection3() instaed - it allows you to specify a userid, domain and password, offering better support,and permitting you to not force the share to map to a local resource, logging into the UNC without tying you to a mapped drive letter,

>z=WNetAddConnection(share_name, "", Drive_Letter)
>
>sometimes z = 1200, 85, 67 or 0
>
>Or using this other function:
>
>SET LIBRARY TO SYS(2004)+'FOXTOOLS.FLL' ADDITIVE
>
>LOCAL xaddconn, xh, xservidor, xletra
>xaddconn=RegFn('WNetAddConnection','CCC','I')
>
>share_name = "\\boss500"
>drive_letter = "G:"
>x=CallFn(xaddconn,share_name,"",drive_letter)
>? x
>
>I know that if I put (:) at the end of the drive letter
>the return value is diferrent.
>Must the drive letter for those function have the (:) at the end or not ?
>I'm asking because in Windows Script Host (Wscript) doesnt comes with the (:) at the end.
>I havent found what the return values of WNetAddConnection mean.
>
>Sample:
>ONET = CREATEOBJECT("WScript.Network")
>oNetDrives = ONET.EnumNetworkDrives
>FOR lni = 0 TO oNetDrives.COUNT - 1 STEP 2
> ? oNetDrives.ITEM(lni)
>ENDFOR
>
>and oNetDrives.ITEM(lni) returns => "\\BOSS500\E" without (:)
>Does it makes difference if Win is 9x, ou Win2K ?
>
>Thank's in Advance
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
Next
Reply
Map
View

Click here to load this message in the networking platform