Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get User Name from the OS
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00147628
Message ID:
00148260
Vues:
23
>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?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform