Hi John

Here is a solution for the Win32 inviroment:


'**** GET THE "USER NAME" [from the network log-in]****
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(lpBuffer As String, nSize As Integer) As Integer
Declare Function UserOnline() as string

Function UserOnline() as String
  DIM x AS INTEGER
  DIM UserStr AS STRING
  DIM lpBuffer AS STRING
  DIM BuffSize AS INTEGER

  BuffSize=1024
  lpBuffer=string$(1024,chr$(32))
  x=GetUserName(lpBuffer, BuffSize)
  UserOnline=lpBuffer
End Function


In some cases the API declare isn�t that differenr when using Win16. Without
knowing if it's going to work try:

Declare Function GetUserName Lib "advapi.dll" Alias "GetUserName" (lpBuffer
As String, nSize As Integer) As Integer

As you see the difference is the "A" in the alias an the name of the DLL
file. It could turn out that the GetUserName function is in anotherr DLL and
then you will have to dig into it some more.


Try it, it's free. ;-)

Thomas Brix Lyng
Frederikshavn Munincipal Administration
Denmark
> ----------
> Fra:  Van Uitregt, John[SMTP:[EMAIL PROTECTED]]
> Sendt:        11. september 2000 07:57
> Til:  '[EMAIL PROTECTED]'
> Emne:         MI: How to GetUserName using call to Windows API
> 
> Hello All,
> 
> I am a regular reader of the MapInfo list and have found many solutions to
> my problems there, but unfortunately not my latest. I need to get the
> current users name from the system somehow. I am using Win3.1 (really),
> Win95 and NT, using MI / MB 4.?, so the solution could be a complex one.
> The
> Win3.1 is not that important but would be handy to have. I have done some
> research on it at the archives (see links below) but I still can't bring
> it
> all together. I have successfully obtained the correct answer from the
> environment in NT, but not all the environments will contain the info
> required, so I think that the solution is API calls ????. So if I could
> hand
> it over to the experts for some help please.
> 
> TIA
> 
> http://testdrive.mapinfo.com/TDC/Mapinfo-L.nsf/12dcce0bd047451985256437006
> 3f
> 39d/232568a002f39be5852565d0004b9188?OpenDocument
> http://testdrive.mapinfo.com/TDC/Mapinfo-L.nsf/12dcce0bd047451985256437006
> 3f
> 39d/c216b33baa16037c852569300004054c?OpenDocument&Highlight=0,lib
> 
> Regards . . .
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> John  van Uitregt  (GIS Analyst)
> Logan City Council, PO Box 3226, Logan City DC, Q 4114, Australia
> Ph : +61-7-3826-5697   Fax : +61-7-3808-0014
> E-mail: mailto:[EMAIL PROTECTED]
> Web Site: http://www.logan.qld.gov.au
> 
> 
> **********************************************************************
> This email and any files transmitted with it are confidential and 
> intended solely for the use of the individual or entity to whom they   
> are addressed. If you have received this email in error please notify 
> the system manager.
> 
> This footnote also confirms that this email message has been swept by 
> MIMEsweeper for the presence of computer viruses.
> 
> www.mimesweeper.com
> **********************************************************************
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
> 
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to