/// [`RegSetKeyValue`](https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexw)
/// method.
///
/// If the value doesn't exist, if will be created. If new type is different
/// from current type, new type will take over.
///
/// # Examples
///
/// ```rust,no_run
/// use winsafe::prelude::*;
/// use winsafe::{HKEY, RegistryValue, WString};
///
/// HKEY::CURRENT_USER.SetKeyValue(
///     "Software\\My Company",
///     "Color",
///     RegistryValue::Sz(WString::from_str("blue")),
/// )?;
/// # Ok::<_, winsafe::co::ERROR>(())
/// ```



If the value doesn't exist, if will be created. If new type is different
from current type, new type will take over.
If the value doesn ' t exist if will be created . If new type is different from current type new type will take over .
fn SetKeyValue(self,
		sub_key: &str, value: &str, data: RegistryValue) -> WinResult<()>
	{
		match co::ERROR(
			unsafe {
				advapi::ffi::RegSetKeyValueW(
					self.as_ptr(),
					WString::from_str(sub_key).as_ptr(),
					WString::from_str(value).as_ptr(),
					data.reg_type().0,
					data.as_ptr(),
					data.len() as _,
				)
			} as _,
		) {
			co::ERROR::SUCCESS => Ok(()),
			err => Err(err),
		}
	}
fn SetKeyValue ( self , sub_key : & str , value : & str , data : RegistryValue ) -> WinResult < ( ) > { match co :: ERROR ( unsafe { advapi :: ffi :: RegSetKeyValueW ( self . as_ptr ( ) , WString :: from_str ( sub_key ) . as_ptr ( ) , WString :: from_str ( value ) . as_ptr ( ) , data . reg_type ( ) . 0 , data . as_ptr ( ) , data . len ( ) as _ , ) } as _ , ) { co :: ERROR :: SUCCESS => Ok ( ( ) ) , err => Err ( err ) , } }
[`RegSetKeyValue`](https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexw)
method.
[ ` RegSetKeyValue ` ] ( https : // docs . microsoft . com / en - us / windows / win32 / api / winreg / nf - winreg - regsetvalueexw ) method .
self
sub_key
&str
value
&str
data
RegistryValue
examples

```rust,no_run
use winsafe::prelude::*;
use winsafe::{HKEY, RegistryValue, WString}.

:CURRENT_USER.SetKeyValue(
"Software\\My Company",
"Color",
RegistryValue::Sz(WString::from_str("blue")),
)?.
` ` ` rust no_run use winsafe :: prelude :: * ; use winsafe :: { HKEY RegistryValue WString } . : CURRENT_USER . SetKeyValue ( " Software \\ My Company " " Color " RegistryValue :: Sz ( WString :: from_str ( " blue " )) ) ? .
ok::<_, winsafe::co::error>(())

None