GetCurrentUser

int GetCurrentUser (char userName[], int bufferSize, unsigned int *actualNameSize);

Purpose

This function returns the name of the user currently logged in to the Windows operating system.

Parameters

Input
Name Type Description
bufferSize integer The size of the buffer, in bytes, passed as the userName parameter. If you are passing NULL into that parameter, then this value is ignored.
Output
Name Type Description
userName char [] Returns the name of the currently logged–in user. This buffer must be large enough to hold the complete name. If you are unsure of the size of the name, you may safely pass NULL in this parameter –– the function will return the User Interface Library error UIEBufTooSmall and the required buffer size, in bytes, will be passed out through the actualNameSize parameter.
actualNameSize unsigned integer * Returns the exact size of the logged–in user's name, including the terminating NULL. The buffer you pass to the userName parameter must be at least this large (or NULL).

Return Value

Name Type Description
status integer The status code that the function returns.

0 indicates success.

A negative value indicates an error.

This function may return a Programmer's Toolbox or UI Library error code. Call GetGeneralErrorString to obtain a text description of the error.