网站首页  词典首页

请输入您要查询的函数:

 

术语 regcreatekey
释义 RegCreateKey
语法:
C++
LONG WINAPI RegCreateKey(
__in HKEY hKey,
__in_opt LPCTSTR lpSubKey,
__out PHKEY phkResult
);
RegCreateKey函数
创建指定的注册表项。如果该键已经在注册表中存在,函数打开它。
注意:此功能仅提供了兼容性与16位的Windows版本。应用程序应该使用RegCreateKeyEx函数。
参数
hKey [in]
句柄到打开注册表项。调用进程必须具有KEY_CREATE_SUB_KEY访问的关键。有关更多信息,请参见注册表关键的安全和访问权限。
这种处理是由RegCreateKeyEx的或RegOpenKeyEx函数,返回的,也可以是下列预定义项之一:
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey [中,可选]
一个关键,此函数打开或创建的名称。这关键的必须是由hKey参数确定的主要子项。欲了解更多有关键名信息,请书记官处的结构。
如果hKey是预定义的关键之一,lpSubKey可能为NULL。在这种情况下,通过使用phkResult处理返回的是一样的hKey句柄传递给函数。
phkResult [out]
一个变量,它接收句柄指针打开或创建的关键。如果关键不是预定义的注册表项之一,调用RegCloseKey函数完成后,您使用的处理。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是一个非零错误代码Winerror.h中定义。您可以使用带有FORMAT_MESSAGE_FROM_SYSTEM标记的FormatMessage函数获得错误的一般说明。
备注
应用程序不能创建一个键是HKEY_USERS或HKEY_LOCAL_MACHINE直接子。应用程序可以创建的于HKEY_USERS或HKEY_LOCAL_MACHINE树木下级子项。
如果您的服务或应用程序模拟不同的用户,不要使用HKEY_CURRENT_USER此功能。相反,调用RegOpenCurrentUser功能。
一个应用程序可以使用RegCreateKey函数来创建一次几个键。例如,一个应用程序可以创建四个子项作为三个指定的参数为lpSubKey以下形式的字符串前面的子项,同时级别深度:
subkey1 \\ subkey2 \\ subkey3 \\ subkey4
如果lpSubKey参数是一个空字符串的地址,该函数的ANSI版本,RegCreateKeyA,打开,然后传回的hKey参数确定的关键。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinreg.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesRegCreateKeyW(Unicode)和RegCreateKeyA(ANSI)的
参见
RegCloseKey
RegCreateKeyEx的
RegDeleteKey
登记职能
注册表概述
RegOpenKeyEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==RegCreateKey Function
Creates the specified registry key. If the key already exists in the registry, the function opens it.
Note This function is provided only for compatibility with 16-bit versions of Windows. Applications should use the RegCreateKeyEx function.
Syntax
C++
LONG WINAPI RegCreateKey(
__in HKEY hKey,
__in_opt LPCTSTR lpSubKey,
__out PHKEY phkResult
);
Parameters
hKey [in]
A handle to an open registry key. The calling process must have KEY_CREATE_SUB_KEY access to the key. For more information, see Registry Key Security and Access Rights .
This handle is returned by the RegCreateKeyEx or RegOpenKeyEx function, or it can be one of the following predefined keys :
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey [in, optional]
The name of a key that this function opens or creates. This key must be a subkey of the key identified by the hKey parameter. For more information on key names, see Structure of the Registry .
If hKey is one of the predefined keys, lpSubKey may be NULL. In that case, the handle returned by using phkResult is the same hKey handle passed in to the function.
phkResult [out]
A pointer to a variable that receives a handle to the opened or created key. If the key is not one of the predefined registry keys, call the RegCloseKey function after you have finished using the handle.
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
An application cannot create a key that is a direct child of HKEY_USERS or HKEY_LOCAL_MACHINE. An application can create subkeys in lower levels of the HKEY_USERS or HKEY_LOCAL_MACHINE trees.
If your service or application impersonates different users, do not use this function with HKEY_CURRENT_USER. Instead, call the RegOpenCurrentUser function.
An application can use the RegCreateKey function to create several keys at once. For example, an application can create a subkey four levels deep at the same time as the three preceding subkeys by specifying a string of the following form for the lpSubKey parameter:
subkey1\\subkey2\\subkey3\\subkey4
If the lpSubKey parameter is the address of an empty string, the ANSI version of the function, RegCreateKeyA, opens and then passes back the key identified by the hKey parameter.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinreg.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesRegCreateKeyW (Unicode) and RegCreateKeyA (ANSI)
See Also
RegCloseKey
RegCreateKeyEx
RegDeleteKey
Registry Functions
Registry Overview
RegOpenKeyEx
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724842(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 更新时间:2025/1/9 4:18:55