Subject: Re: who am I?
// ** Does no error checking **
function GetUserNameAsString : string;
var
szUserName : pChar;
iSize : integer;
begin
iSize := 255;
szUserName := StrAlloc( iSize );
GetUserName( szUserName, iSize );
Result := StrPas( szUserName );
StrDispose( szUserName )
end;
>----------
>Subject: who am I?
>
>hi,
>
>I am developing a programme under WinNT with D2. I want to learn
>'what is my username?' when my programme connects to WinNt server.
>Are there any command in Delphi 2 to make this?
----------
------------
Subject: Re: What is my username?
procedure DisplayPuterName;
var
CompName : Array [1..20] of Char;
SizeD : DWord;
begin
SizeD := 15;
GetComputerName( @CompName, SizeD );
ShowMessage( CompName );
end;
>----------
>Subject: Re: What is my username?
>
>hi,
>
>I have tried GetComputerName command. There is a error. I have
>used GetLastError command to trap error code. The error code is
>87 and its mean is 'ROR_INVALID_PARAMETER'. What can I do?
----------
--------------
Subject: FW: who am I?
try to use the API WNetGetUser ....
> Subject: who am I?
>
> hi,
>
> I am developing a programme under WinNT with D2. I want to learn
> 'what is my username?' when my programme connects to WinNt server.
> Are there any command in Delphi 2 to make this?
----------