网站首页  词典首页

请输入您要查询的函数:

 

术语 setcomputernameex
释义 SetComputerNameEx
语法:
C++
BOOL WINAPI SetComputerNameEx(
__in COMPUTER_NAME_FORMAT NameType,
__in LPCTSTR lpBuffer
);
SetComputerNameEx功能
设置一个新的NetBIOS本地计算机或DNS名称。由SetComputerNameEx了名称的更改不会生效,直到用户重新启动计算机。
参数
NameType [in]
该类型的名称设置。此参数可从COMPUTER_NAME_FORMAT枚举类型为下列值之一。
ValueMeaning
ComputerNamePhysicalDnsDomainSets的主DNS后缀的计算机。
ComputerNamePhysicalDnsHostnameSets NetBIOS和计算机名称(名称的完整DNS第一个标签)在lpBuffer指定的名称。如果名称超过MAX_COMPUTERNAME_LENGTH字符,NetBIOS名称被截断为MAX_COMPUTERNAME_LENGTH字符,不包括终止空字符。
ComputerNamePhysicalNetBIOSSets NetBIOS名称在lpBuffer指定的名称。名称不能超过MAX_COMPUTERNAME_LENGTH字符,不包括终止空字符。
警告:使用此选项设置NetBIOS名称打破了相互依存的NetBIOS和DNS名称公约。应用程序使用的DnsHostnameToComputerName功能能够从DNS名称的第一个标签的NetBIOS名称将失败,如果这一公约被打破了。
lpBuffer [in]
新的名称。该名称不能包含控制字符,前导或尾随空格,或任何以下字符:“/ \\ []:|”“+ =;,?
返回值
如果函数成功,返回值是一个非零值。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
SetComputerNameEx可以设置计算机名称(名称的完整DNS第一个标签)或主DNS后缀本地计算机。它不能在一个呼叫设置一个完全合格的DNS名称。
如果本地计算机是一个群集节点,SetComputerNameEx集的NetBIOS或DNS本地计算机的名称,而不是群集的虚拟服务器。
该进程调用SetComputerNameEx函数必须在本地计算机的管理员权限。
要编译的应用程序使用此功能,定义_WIN32_WINNT为0x0500或更高版本。有关详细信息,请参阅使用Windows头。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesSetComputerNameExW(Unicode)和SetComputerNameExA(ANSI)的
参见
计算机名称
COMPUTER_NAME_FORMAT
DnsHostnameToComputerName
GetComputerName
GetComputerNameEx
SetComputerName
系统信息功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==SetComputerNameEx Function
Sets a new NetBIOS or DNS name for the local computer. Name changes made by SetComputerNameEx do not take effect until the user restarts the computer.
Syntax
C++
BOOL WINAPI SetComputerNameEx(
__in COMPUTER_NAME_FORMAT NameType,
__in LPCTSTR lpBuffer
);
Parameters
NameType [in]
The type of name to be set. This parameter can be one of the following values from the COMPUTER_NAME_FORMAT enumeration type.
ValueMeaning
ComputerNamePhysicalDnsDomainSets the primary DNS suffix of the computer.
ComputerNamePhysicalDnsHostnameSets the NetBIOS and the Computer Name (the first label of the full DNS name) to the name specified in lpBuffer. If the name exceeds MAX_COMPUTERNAME_LENGTH characters, the NetBIOS name is truncated to MAX_COMPUTERNAME_LENGTH characters, not including the terminating null character.
ComputerNamePhysicalNetBIOSSets the NetBIOS name to the name specified in lpBuffer. The name cannot exceed MAX_COMPUTERNAME_LENGTH characters, not including the terminating null character.
Warning: Using this option to set the NetBIOS name breaks the convention of interdependent NetBIOS and DNS names. Applications that use the DnsHostnameToComputerName function to derive the NetBIOS name from the first label of the DNS name will fail if this convention is broken.

lpBuffer [in]
The new name. The name cannot include control characters, leading or trailing spaces, or any of the following characters: " / \\ [ ] : | < > + = ; , ?
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
SetComputerNameEx can set the Computer Name (the first label of the full DNS name) or the primary DNS suffix of the local computer. It cannot set a fully-qualified DNS name in one call.
If the local computer is a node in a cluster, SetComputerNameEx sets NetBIOS or DNS name of the local computer, not that of the cluster virtual server.
The process that calls the SetComputerNameEx function must have administrator privileges on the local computer.
To compile an application that uses this function, define _WIN32_WINNT as 0x0500 or later. For more information, see Using the Windows Headers .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesSetComputerNameExW (Unicode) and SetComputerNameExA (ANSI)
See Also
Computer Names
COMPUTER_NAME_FORMAT
DnsHostnameToComputerName
GetComputerName
GetComputerNameEx
SetComputerName
System Information Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724931(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:25:37