网站首页  词典首页

请输入您要查询的函数:

 

术语 regsetvalueex
释义 RegSetValueEx
语法:
C++
LONG WINAPI RegSetValueEx(
__in HKEY hKey,
__in_opt LPCTSTR lpValueName,
__reserved DWORD Reserved,
__in DWORD dwType,
__in_opt const BYTE *lpData,
__in DWORD cbData
);
RegSetValueEx函数
设置一个注册表项下的数据和指定值的类型。
参数
hKey [in]
句柄到打开注册表项。关键必须是开放的KEY_SET_VALUE访问权限。有关更多信息,请参见注册表关键的安全和访问权限。
这种处理是由RegCreateKeyEx的,RegCreateKeyTransacted,RegOpenKeyEx,或RegOpenKeyTransacted函数返回。它也可以是下列预定义项之一:
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_PERFORMANCE_DATA
HKEY_USERS
lpValueName [中,可选]
The name of the value to be set.如果这个名字的价值尚未在目前的关键,它的功能添加的关键。
如果lpValueName是NULL或空字符串,“”,该函数设置类型和数据的主要的未命名或默认值。
有关更多信息,请注册元素的大小限制。
注册表项没有默认值,但他们可以有一个未命名的值,它可以是任何类型。
保留
这个参数是保留,必须为零。
dwType [in]
类型的数据所指向lpData参数。对于可能的类型的列表,请参阅注册表值类型。
lpData [中,可选]
对数据进行存储。
对于基于字符串的类型,如为REG_SZ,该字符串必须空终止。随着REG_MULTI_SZ数据类型,字符串必须终止两个空字符。
cbData [in]
的资料指出,大小由lpData参数,以字节为单位。如果数据类型是REG_SZ,REG_EXPAND_SZ的,或均为REG_MULTI_SZ,cbData必须包括终止空字符或字符大小。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是一个非零错误代码Winerror.h中定义。您可以使用带有FORMAT_MESSAGE_FROM_SYSTEM标记的FormatMessage函数获得错误的一般说明。
备注
价值的大小是有限的可用内存。长值(超过2048字节)应与文件名文件存储存储在注册表中。这有助于注册表有效地执行。应用元素,如图标,位图和可执行文件应作为文件存储,而不是在注册表中。
如果却提示是REG_SZ,均为REG_MULTI_SZ,或REG_EXPAND_SZ类型,该函数的ANSI版本使用(或通过显式调用RegSetValueExA或不明确之前,包括WINDOWS.H文件的UNICODE),数据指出lpData参数来的,必须一个ANSI字符串。该字符串转换为Unicode之前,存储在注册表中。
请注意,操作访问某些注册表项被重定向。有关更多信息,请在注册处注册,虚拟化和32位和64位应用程序数据。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinreg.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesRegSetValueExW(Unicode)和RegSetValueExA(ANSI)的
参见
RegCreateKeyEx的
RegFlushKey
登记职能
注册表概述
RegOpenKeyEx
RegQueryValueEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==RegSetValueEx Function
Sets the data and type of a specified value under a registry key.
Syntax
C++
LONG WINAPI RegSetValueEx(
__in HKEY hKey,
__in_opt LPCTSTR lpValueName,
__reserved DWORD Reserved,
__in DWORD dwType,
__in_opt const BYTE *lpData,
__in DWORD cbData
);
Parameters
hKey [in]
A handle to an open registry key. The key must have been opened with the KEY_SET_VALUE access right. For more information, see Registry Key Security and Access Rights .
This handle is returned by the RegCreateKeyEx , RegCreateKeyTransacted , RegOpenKeyEx , or RegOpenKeyTransacted function. It can also be one of the following predefined keys :
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_PERFORMANCE_DATA
HKEY_USERS
lpValueName [in, optional]
The name of the value to be set. If a value with this name is not already present in the key, the function adds it to the key.
If lpValueName is NULL or an empty string, "", the function sets the type and data for the key's unnamed or default value.
For more information, see Registry Element Size Limits .
Registry keys do not have default values, but they can have one unnamed value, which can be of any type.
Reserved
This parameter is reserved and must be zero.
dwType [in]
The type of data pointed to by the lpData parameter. For a list of the possible types, see Registry Value Types .
lpData [in, optional]
The data to be stored.
For string-based types, such as REG_SZ, the string must be null-terminated. With the REG_MULTI_SZ data type, the string must be terminated with two null characters.
cbData [in]
The size of the information pointed to by the lpData parameter, in bytes. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ, cbData must include the size of the terminating null character or characters.
Return Value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
Remarks
Value sizes are limited by available memory. Long values (more than 2048 bytes) should be stored as files with the file names stored in the registry. This helps the registry perform efficiently. Application elements such as icons, bitmaps, and executable files should be stored as files and not be placed in the registry.
If dwType is the REG_SZ, REG_MULTI_SZ, or REG_EXPAND_SZ type and the ANSI version of this function is used (either by explicitly calling RegSetValueExA or by not defining UNICODE before including the Windows.h file), the data pointed to by the lpData parameter must be an ANSI character string. The string is converted to Unicode before it is stored in the registry.
Note that operations that access certain registry keys are redirected. For more information, see Registry Virtualization and 32-bit and 64-bit Application Data in the Registry .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinreg.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesRegSetValueExW (Unicode) and RegSetValueExA (ANSI)
See Also
RegCreateKeyEx
RegFlushKey
Registry Functions
Registry Overview
RegOpenKeyEx
RegQueryValueEx
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724923(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:22:42