网站首页  词典首页

请输入您要查询的函数:

 

术语 getusername
释义 GetUserName
语法:
C++
BOOL WINAPI GetUserName(
__out LPTSTR lpBuffer,
__inout LPDWORD lpnSize
);
GetUserName函数
检索与当前线程关联的用户名。
使用GetUserNameEx函数检索指定的格式的用户名。更多信息,提供IADsADSystemInfo接口。
参数
lpBuffer [out]
一个缓冲区指针接收用户的登录名。如果此缓冲区不够大,无法包含整个用户名,函数失败。一个(云伦+缓冲区大小1)字符将举行的最大长度,其中包括终止空字符的用户名。云伦的定义Lmcons.h。
lpnSize [ in , out ]
在输入,这个变量指定lpBuffer缓冲区的大小在TCHARs。在输出的变量接收到复制到缓冲区TCHARs,包括终止空字符。
如果lpBuffer太小,函数失败并GetLastError返回ERROR_INSUFFICIENT_BUFFER。此参数接收所需的缓冲区大小,包括终止空字符。
如果该参数大于32767更大,函数失败并GetLastError返回ERROR_INSUFFICIENT_BUFFER。
返回值
如果函数成功,返回值是一个非零值,和变量指向lpnSize载由lpBuffer复制到指定的缓冲区,包括终止空字符TCHARs数目。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
如果当前线程是假冒其他客户端,GetUserName函数返回的客户端的线程正在模拟的用户名。
实例
有关示例,请参见获取系统信息。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesGetUserNameW(Unicode)和GetUserNameA(ANSI)的
参见
GetUserNameEx
LookupAccountName
系统信息功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==GetUserName Function
Retrieves the name of the user associated with the current thread.
Use the GetUserNameEx function to retrieve the user name in a specified format. Additional information is provided by the IADsADSystemInfo interface.
Syntax
C++
BOOL WINAPI GetUserName(
__out LPTSTR lpBuffer,
__inout LPDWORD lpnSize
);
Parameters
lpBuffer [out]
A pointer to the buffer to receive 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.
lpnSize [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_INSUFFICIENT_BUFFER. This parameter receives the required buffer size, including the terminating null character.
If this parameter is greater than 32767, the function fails and GetLastError returns ERROR_INSUFFICIENT_BUFFER.
Return Value
If the function succeeds, the return value is a nonzero value, and the variable pointed to by lpnSize 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.
Examples
For an example, see Getting System Information .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesGetUserNameW (Unicode) and GetUserNameA (ANSI)
See Also
GetUserNameEx
LookupAccountName
System Information Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724432(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:24:54