>>>I am trying to use WNetGetUser in vfp. I have declared the function before using it. But for some reason I get an error, 1726 'API Library not found'. One last note, the error does not occur till after the function has already ran and returns the correct value.
>>>
>>
>>I think something other than this API call is at fault; the WNetGetUser code is close enough to what I use that it should run reliably (there are differences in what I do to the returned value to clean it up on a successful return, but they have no effect on how the API call is made.
>>
>>I would make sure that you use the code as shown; if something is issuing a CLEAR DLLS or something similar, or redeclaring the API call somewhere else after where you thought you'd already declared it, you might be getting hurt by side-effects. It's safest to issue the DECLARE...DLL in the function that uses it.
>>
>>>One last note, the dll hooked up is C:\Windows\System\MPR.DLL
>>
>>That's not always true - WinNT and Win9x use different providers for the WNet family of API calls; as long as you're using the WIN32API catchall as shown, you should be covered.
>>
>>If you run the code in the debugger, exactly what line does the
API Library not found occur on?
>>
>>>
>Looks like it is choking on the release library statement.
>
>My Function follows
>---------------------------------------------------------------------
>set classlibr to x
>
>o = createobject(myform) && which has the function finduser
> && also myform is modal
>
>release libr x <----Choking right here...
You want to RELEASE CLASSLIB, not RELEASE LIBRARY. RELEASE LIBRARY is used to disconnect from .FLL files; the message now makes sense, since you don't have an X.FLL attached to your application.
>---------------------------------------------------------------------