网站首页  词典首页

请输入您要查询的函数:

 

术语 getcomputername
释义 GetComputerName
语法:
C++
BOOL WINAPI GetComputerName(
__out LPTSTR lpBuffer,
__inout LPDWORD lpnSize
);
GetComputerName函数
检索本地计算机的NetBIOS名称。这个名字是建立在系统启动时,当系统从注册表中读取它。
GetComputerName仅检索本地计算机的NetBIOS名称。要检索的DNS主机名,DNS域名,或完全合格的DNS名称,调用GetComputerNameEx功能。更多信息,提供IADsADSystemInfo接口。
这个函数的行为可能会受到影响,如果在本地计算机是一个群集节点。有关更多信息,请参阅ResUtilGetEnvironmentWithNetName和UseNetworkName。
参数
lpBuffer [out]
阿一个缓冲区,它接收的计算机名称或群集的虚拟服务器名称的指针。缓冲区的大小应该足够大,以遏制MAX_COMPUTERNAME_LENGTH + 1个字符。
lpnSize [ in , out ]
在输入,指定缓冲区的大小TCHARs。在产出,复制到目标缓冲区TCHARs人数,不包括终止空字符。
如果缓冲区太小,函数失败并GetLastError返回ERROR_BUFFER_OVERFLOW。在lpnSize参数指定所需的缓冲区,包括终止空字符大小。
返回值
如果函数成功,返回值是一个非零值。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
在GetComputerName函数检索NetBIOS名称在系统启动时建立。由SetComputerName或SetComputerNameEx职能作出名称的更改不会生效,直到用户重新启动计算机。
如果调用方是根据客户端会话中运行,该函数返回服务器的名称。要检索的客户名称,使用WTSQuerySessionInformation功能。
实例
有关示例,请参见获取系统信息。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesGetComputerNameW(Unicode)和GetComputerNameA(ANSI)的
参见
计算机名称
GetComputerNameEx
SetComputerName
SetComputerNameEx
系统信息功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==GetComputerName Function
Retrieves the NetBIOS name of the local computer. This name is established at system startup, when the system reads it from the registry.
GetComputerName retrieves only the NetBIOS name of the local computer. To retrieve the DNS host name, DNS domain name, or the fully qualified DNS name, call the GetComputerNameEx function. Additional information is provided by the IADsADSystemInfo interface.
The behavior of this function can be affected if the local computer is a node in a cluster. For more information, see ResUtilGetEnvironmentWithNetName and UseNetworkName .
Syntax
C++
BOOL WINAPI GetComputerName(
__out LPTSTR lpBuffer,
__inout LPDWORD lpnSize
);
Parameters
lpBuffer [out]
A pointer to a buffer that receives the computer name or the cluster virtual server name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.
lpnSize [in, out]
On input, specifies the size of the buffer, in TCHARs. On output, the number of TCHARs copied to the destination buffer, not including the terminating null character.
If the buffer is too small, the function fails and GetLastError returns ERROR_BUFFER_OVERFLOW. The lpnSize parameter specifies the size of the buffer required, including the terminating null character.
Return Value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The GetComputerName function retrieves the NetBIOS name established at system startup. Name changes made by the SetComputerName or SetComputerNameEx functions do not take effect until the user restarts the computer.
If the caller is running under a client session, this function returns the server name. To retrieve the client name, use the WTSQuerySessionInformation function.
Examples
For an example, see Getting System Information .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesGetComputerNameW (Unicode) and GetComputerNameA (ANSI)
See Also
Computer Names
GetComputerNameEx
SetComputerName
SetComputerNameEx
System Information Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724295(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:23:04