Create Global External Function
FUNCTION Boolean GetUserName ( &
REF String lpBuffer, &
REF UnsignedLong nSize &
) LIBRARY "ADVAPI32.DLL" ALIAS FOR "GetUserNameA;Ansii"
// This DLL is windows DLL and will be available in all windows machines
This should be in windows events
// Declare local variables
String ls_userName
UnsignedLong lul_size = 256 // Start with a sufficient buffer size
Boolean lb_rc
// Initialize the string buffer with spaces
ls_userName = Space(256)
// Call the Windows API function
lb_rc = GetUserName(ls_userName, lul_size)
// Check the return code and extract the user ID
If lb_rc Then
MessageBox('User ID', 'User ID is: ' + ls_userName)
Else
// Handle error (e.g., the buffer was too small, although 256 is usually plenty)
MessageBox('Error', 'Failed to retrieve Windows User ID.')
End If
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)