# Function Reference

# _WinAPI_RegFlushKey

Writes all the attributes of the specified open registry key into the registry

#include <WinAPIReg.au3>
_WinAPI_RegFlushKey ( $hKey )

## Parameters

$hKey | Handle to an open registry key. The key must have been opened with the $KEY_QUERY_VALUE access right. This handle is returned by the _WinAPI_RegCreateKey() or _WinAPI_RegOpenKey() 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

## Return Value

Success: | 1.
Failure: | 0 and sets the @error flag to non-zero, @extended flag may contain the system error code.

## Remarks

The _WinAPI_RegFlushKey() function returns only when all the data for the hive that contains the specified key has been written to the registry store on disk.
The _WinAPI_RegFlushKey() function writes out the data for other keys in the hive that have been modified since the last lazy flush or system start.
After _WinAPI_RegFlushKey() returns, use _WinAPI_RegCloseKey() to close the handle to the registry key.

## Related

_WinAPI_RegCloseKey, _WinAPI_RegCreateKey, _WinAPI_RegOpenKey

## See Also

Search RegFlushKey in MSDN Library.