Delphi Examples: DbiGetNetUserName

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiGetNetUserName

Return to chapter overview

Return the user's network login name.

User names are available for all networks supported by Microsoft Windows.

This example uses the following input:

 MyName := GetMyNetUserName;

 

The function is:

function GetMyNetUserName: String;

begin

  SetLength(Result, dbiMaxUserNameLen + 1);

  Check(DbiGetNetUserName(PChar(Result)));

  SetLength(Result, StrLen(PChar(Result)));

end;