Peter, That worked fine, thank you. I did post an earlier reply to yourself and to Lars who also helped, but I'm not sure that it posted successfully.
Best wishes, - Richard ----- Original Message ----- From: "Peter Horsb�ll M�ller" <[EMAIL PROTECTED]> To: "'Richard Greenleaf'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, November 15, 2003 3:40 PM Subject: RE: MI-L Getting User Name? Hi Richard, Try this: ****************************************************************** Declare Function GetUserName lib "advapi32.dll" alias "GetUserNameA" (lpBuffer As String, nSize As Integer) As Integer Declare Function APIGetUserName$() As String '-------------------------------------------------------------------- Function APIGetUserName$() As String Dim nRc As Integer, szName As String, nLen As Integer OnError GoTo ErrorOccured nLen = 1024 szName = String$(nLen, chr$(32)) nRc = GetUserName(szName, nLen) APIGetUserName$ = szName Exit Function '------------------------- ErrorOccured: APIGetUserName$ = "Unknown" End Function ****************************************************************** Peter Horsb�ll M�ller GIS Developer Geographical Information & IT COWI A/S Rug�rdsvej 55 DK-5000 Odense Denmark Tel +45 6313 5013 Direct +45 6313 5008 Mob +45 5156 1045 Fax +45 6313 5090 E-mail [EMAIL PROTECTED] http://www.cowi.dk > -----Original Message----- > From: Richard Greenleaf [mailto:[EMAIL PROTECTED] > Sent: Saturday, November 15, 2003 12:28 PM > To: [EMAIL PROTECTED] > Subject: MI-L Getting User Name? > > > I'm writing a MapBasic program that needs to respond > differently according to who has logged on to the PC. So I > need to call the Windows API that will retrieve the User > Name. Can anyone advise me please how to do this, assuming > that it can be done? > > - Richard > --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 9162 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 9273
