Void csltestdlg: onbutton3 ()
{
// Todo: add your control notification handler code here
// Read the value in the Registry
Hkey;
// DWORD dwtype;
Tchar sznameserver [256];
// Lpbyte
DWORD dwdatasize = 256;
// Lpdword
DWORD dwtype;
Long retval = regopenkeyex (HKEY_LOCAL_MACHINE, "System \ CurrentControlSet \ Services \ umbus", 0, key_query_value, & hkey );
If (retval = error_success)
// If the call is successful
{
Regqueryvalueex (hkey, _ T ("displayname"), null, & dwtype, (lpbyte) sznameserver, & dwdatasize );
// Obtain the value
}
Afxmessagebox (cstring) sznameserver );
// Create a key value
Long retva = regcreatekeyex (HKEY_LOCAL_MACHINE, "System \ CurrentControlSet \ Services \ Gogo", 0,
Null, reg_option_non_volatile, key_all_access, null, & hkey, null );
If (retval = error_success)
{
If (regsetvalueex (hkey, _ T ("happy"), 0, dwtype, null, null) = error_success)
// Write data
{
Afxmessagebox ("written successfully ");
}
Else
{
Afxmessagebox ("Write failed ");
}
}
Regclosekey (hkey );
}
If a write failure occurs, why not ??