Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems using API
Message
From
18/08/1999 10:25:56
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Problems using API
Miscellaneous
Thread ID:
00254972
Message ID:
00254972
Views:
57
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.

One last note, the dll hooked up is C:\Windows\System\MPR.DLL


Here is the function I am using:
*==============================================================================
* Method: GetDefaultUserName
* Purpose: Gets the name of the user logged onto the machine at the * operating system level.
* Author: F1 Technologies
* Parameters:
* Returns:
*==============================================================================
LOCAL ;
lcNull, ;
lcUserId, ;
lnLen

lcNull=""
lcUserId=SPACE(255)
lnLen=255

* Use the WNetGetUser function in the Win32API to get the user id
DECLARE INTEGER WNetGetUser IN WIN32API String @, String @, Integer @
IF WNetGetUser(@lcNull,@lcUserId,@lnLen)=0
lcUserId=UPPER(LEFT(lcUserId,AT(CHR(0),lcUserId)-1))
ELSE
lcUserId = ""
ENDIF

RETURN ALLTRIM(lcUserId)
Next
Reply
Map
View

Click here to load this message in the networking platform