Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WNetAddConnection2-Win32API
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00006162
Message ID:
00006178
Views:
55
>I am wanting to use this API call in VFP to connect to a server. I presently have:
>DECLARE INTEGER WNetAddConnection2 in Win32API AS AddNetConnect;
> STRING,STRING,STRING,INTEGER
>
> AddRetVal=AddNetConnect('\\SSC_DB\sys','password','dbuser2',0)
>Now, my first problem is that the first parameter, lpNetResource is of type LPNETRESOURCE not STRING. How do I tell VFP that?
>I can logon with the present version but it returns 487(invalid pointer)and log on under the 'current user' ID; a result of wrong type. Has anyone had luck using this API call?

I think you need to declare it like:

DECLARE INTEGER WNetAddConnection2 IN Win32API AS AddNetConnect;
@STRING, @STRING, @STRING, INTEGER

Then call it with:

sNetResource = '\\SCC_DB\sys'
sPassword = 'password'
sUserName = 'dbuser2'

iRetVal = AddNetConnect(@sNetResource, @sPassword, @sUserName, 0)

HTH!
alistair israel
Distressed DBA, Sleepy SysAd, Weary WebMaster (aka Senior Software Engineer)
aisrael@poboxes.com
Makati City, Philippines
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform