Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function sets a REG_DWORD registry value.
Syntax
HRESULT WINAPI RegistrySetDWORD( HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValueName, DWORD dwData ); |
Parameters
- hKey
-
[in] Handle to the open key or a predefined root value.
- pszSubKey
-
[in] Key where the value is stored. If this value is NULL, then pszValueNameis assumed to be under hkey.
- pszValueName
-
[in] Named value to set. If this value is NULL, the function sets the default value.
- dwData
-
[in] New value.
Return Value
The following table shows the return values for this function.
Value | Description |
---|---|
S_OK |
Value in pszValueNameis replaced by the value in dwData. |
E_INVALIDARG |
Invalid hkey. |
E_DATATYPE_MISMATCH |
The value is not type REG_DWORD. |
An error value returned by RegOpenKeyor RegQueryValueEx. |
Error value wrapped as a FACILITY_WIN32 HRESULT. |
Remarks
Success indicates that the old value is replaced by the new value. Failure does cause any change.
If the key pointed to by hkeyand pszSubkeydoes not exist, the function fails.
If the client might be calling RegistrySetDWORDmultiple times, it should cache a handle to the key using RegOpenKeyExand pass the handle instead of passing a string value. Every time RegistrySetDWORDis called with a string value for the key, the RegOpenKeyExand RegCloseKeyfunctions are called, so passing a handle instead of a string value can avert a potential performance problem over mutltiple calls.
Requirements
Header | regext.h |
Library | aygshell.lib |
Windows Embedded CE | Windows Embedded CE 6.0 and later |
Windows Mobile | Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later |
See Also
Reference
State and Notifications Broker FunctionsState and Notifications Broker Reference