Visual Basic > Windows and Controls
Get the current username
Get the current username 'on a Module Declare Function wu_WNetGetUser% Lib "USER.EXE" alias "WNetGetUser" (ByVal szUser$, lpnBufferSize%) Global NovellName$ Function NetworkUserID () As String dim szUser As String * 255 dim lpnBufferSize% dim status% lpnBufferSize = 255 status% = wu_WNetGetUser(szUser, lpnBufferSize) If status% = 3 Then NetworkUserID = "Error" Unload form1 Else NetworkUserID = Left$(szUser, InStr(szUser, Chr(0)) - 1) end If End Function 'Use as: NovellName = NetworkUserID() Return
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows