Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Make network connection from scheduled task
Message
 
To
06/11/2004 08:30:55
Guy Pardoe
Pardoe Development Corporation
Peterborough, New Hampshire, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00958713
Message ID:
00958818
Views:
18
Hi Guy,

I have code samples with WNetAddConnection and WNetAddConnection2 API calls, but I don't think they will work any different from WScript approach.

Connecting a local device to a network resource
http://www.news2news.com/vfp/?example=318&function=491

Mapping and disconnecting network drives in FoxPro application
http://www.news2news.com/vfp/?example=387

Why don't you try LogonUser API.
http://www.news2news.com/vfp/?group=-1&function=698

What does it mean you have no user credentials? If this app is running there should be some user behind. What does SYS(0) return? If a network resourse requires access credentials, there is no way but provide some.
#DEFINE NO_ERROR  0

DECLARE INTEGER WNetAddConnection IN mpr;
	STRING lpRemoteName, STRING lpPassw, STRING lpLocalName

LOCAL nResult
WAIT WINDOW NOWAIT "Establishing network connection... "
nResult = WNetAddConnection("\\myserver\c", "", "Z:")
WAIT CLEAR

*    5 - ERROR_ACCESS_DENIED
*   53 - ERROR_BAD_NETPATH
*   66 - ERROR_BAD_DEV_TYPE
*   67 - ERROR_BAD_NET_NAME
*   85 - ERROR_ALREADY_ASSIGNED
* 1200 - ERROR_BAD_DEVICE
* 1202 - ERROR_DEVICE_ALREADY_REMEMBERED
* 1203 - ERROR_NO_NET_OR_BAD_PATH
* 1206 - ERROR_BAD_PROFILE
* 1208 - ERROR_EXTENDED_ERROR
Previous
Reply
Map
View

Click here to load this message in the networking platform