General information
Category:
Windows API functions
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only