Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get User Name from the OS
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00147628
Message ID:
00148260
Views:
22
>I am trying to obtain the User name from the OS in a Win95 or NT environment from a 16 bit FoxPro (2.6 for windows) program. This is easily done from a 32 bit program using the GetUserName API. Can I address the 32 bit API from a 16 bit program? Or, is there another way of obtaing the User Name from a 16 bit app??

The most reliable way to get the username is to use the API:
************************************************************************
PROCEDURE GetUserName
**********************
***  Modified: 08/17/95
***  Function: Returns the name of the user logged into the
***            network
***      Pass: pcServer  -  Name of server or network resource
***                         must include "\\" for servers...
***
***    Return: User Name used to connect to resource
************************************************************************

DECLARE Integer GetUserName ;
   IN WIN32API AS GUserName ;
   STRING @nBuffer, ;
   INTEGER @nBufferSize

lcUserName=space(255)
lnLength=len(lcUserName)

lnError=GUserName(@lcUserName,@lnLength)

RETURN TRIM(CHRTRAN(lcUserName,CHR(0),""))
*EOP GetUserName
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform