Chertenok.ru - все о программировании
Вход  |  Регистрация  |  Поиск 
Праздник
Завтра :

День славянской письменности и культуры


Об имени пользователя...
На страницу Пред.  1, 2

Новая тема  Ответить  Печать Предыдущая тема  Следующая тема
Автор Сообщение
Пол:Муж Ktf
Администратор


Возраст: 32
Знак зодиака: Рак
Зарегистрирован: 15.05.2005
Сообщения: 1502
Откуда: localhost
СообщениеПт, 20-Май-2005 13:08 
Цитата

или так:

Код:
function GetUserName: string;
var
  n: cardinal;
  c: array[0..199] of char;
begin
  c := '';
  n := 200;
  if Windows.GetUserName(c, n) then
    result:=c;
end;
В начало
Посмотреть профиль Отправить личное сообщение
Пол:Муж aka57
Я живу тут....


Возраст: 28
Знак зодиака: Стрелец
Зарегистрирован: 03.07.2003
Сообщения: 1287

СообщениеВт, 24-Май-2005 17:46 
Цитата

GetUserName

The GetUserName function retrieves the user name of the current thread. This is the name of the user currently logged onto the system.

Use the GetUserNameEx function to retrieve the user name in a specified format. Additional information is provided by the IADsADSystemInfo interface.

Код:
BOOL GetUserName(
  LPTSTR lpBuffer,
  LPDWORD nSize
);


Parameters
lpBuffer
[out] Pointer to the buffer to receive the null-terminated string containing the user's logon name. If this buffer is not large enough to contain the entire user name, the function fails. A buffer size of (UNLEN + 1) characters will hold the maximum length user name including the terminating null character. UNLEN is defined in Lmcons.h.
nSize
[in, out] On input, this variable specifies the size of the lpBuffer buffer, in TCHARs. On output, the variable receives the number of TCHARs copied to the buffer, including the terminating null character.
If lpBuffer is too small, the function fails and GetLastError returns ERROR_MORE_DATA. This parameter receives the required buffer size, including the terminating null character.

Return Values
If the function succeeds, the return value is a nonzero value, and the variable pointed to by nSize contains the number of TCHARs copied to the buffer specified by lpBuffer, including the terminating null character.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If the current thread is impersonating another client, the GetUserName function returns the user name of the client that the thread is impersonating.

Windows Me/98/95: GetUserNameW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows Me/98/95 Systems
В начало
Посмотреть профиль Отправить личное сообщение
Показать сообщения:   
Страница 2 из 2 На страницу Пред.  1, 2
Перейти:  
Новая тема  Ответить  Печать

Вы можете начинать темы
Вы можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах
Вы не можете присоединять файлы в этом форуме
Вы можете скачивать файлы в этом форуме
хостинг от .masterhost 
Rambler's Top100