Board index » delphi » Getting the User Name From Windows 95 or NT 4.0 using Delphi 2.0

Getting the User Name From Windows 95 or NT 4.0 using Delphi 2.0

I have several computers sharing resources. How could I get the user
name of the user that modifies a table? Please e-mail.

Thanks,

Bill Taylor
b...@btechdesign.com

 

Re:Getting the User Name From Windows 95 or NT 4.0 using Delphi 2.0


You can use this API call under Win NT or 95:

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal
lpBuffer As String, nSize As Long) As Long

This will return the current user that is loged onto the workstation.

Regards

Adriaan van Wyk

Quote
Bill Taylor wrote in message <34E15717.2...@btechdesign.com>...
>I have several computers sharing resources. How could I get the user
>name of the user that modifies a table? Please e-mail.

>Thanks,

>Bill Taylor
>b...@btechdesign.com

Re:Getting the User Name From Windows 95 or NT 4.0 using Delphi 2.0


You can use this API call under Win NT or 95:

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal
lpBuffer As String, nSize As Long) As Long

This will return the current user that is loged onto the workstation.

Regards

Adriaan van Wyk

Quote
Bill Taylor wrote in message <34E15717.2...@btechdesign.com>...
>I have several computers sharing resources. How could I get the user
>name of the user that modifies a table? Please e-mail.

>Thanks,

>Bill Taylor
>b...@btechdesign.com

Re:Getting the User Name From Windows 95 or NT 4.0 using Delphi 2.0


In article <6btvi8$bq...@news01.iafrica.com>, Adriaan van Wyk
<adri...@archondata.com> writes

Quote
>You can use this API call under Win NT or 95:

>Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal
>lpBuffer As String, nSize As Long) As Long

>This will return the current user that is loged onto the workstation.

I thought this was a Delphi newsgroup?

procedure TForm1.Button1Click(Sender: TObject);
var
  Buffer : array[0..255] of Char;
  Size  : DWORD;
begin
  Size := SizeOf(Buffer);
  if GetUserName(Buffer, Size) then
    ShowMessage(StrPas(Buffer));
end;
--
Jeremy Collins

Other Threads