save_default_checkboxes

 

Description

Save the given array of boolean values into a single DWORD in the registry.

Syntax

bool save_default_checkboxes( LPCSTR lpcszDlgName, const vector<byte> & vbValues, LPCSTR lpcszKey = NULL )

Parameters

lpcszDlgName
[input]name of the dialog, this is used as the section name in the registry under /Dialogs/lpcszDlgName
vbValues
[input]array of 1 and 0 that each will be assigned to a bit in the DWORD value saved into registry
lpcszKey
[input]Value name in registry to save, if not specified, CheckBoxes will be used

Return

True for success, false for error.

Examples

EX1

#include <GetNBox.h>
void save_default_checkboxes_Ex1()
{
    vector<byte> vbValues ;
        
    LPCSTR dlgName="testDlg" ;
    LPCSTR valueName="Test";
        
        
    GETN_TREE(tr)
                GETN_CHECK(CH1, "Check1",false)
                GETN_CHECK(CH2,"Check2", true)
                GETN_CHECK(CH3, "Check3",false)
        
        //initialize tree value for defalut setting 
    if(load_default_checkboxes(dlgName,vbValues,valueName))
    {
        tr.CH1.nVal=vbValues[0];
        tr.CH2.nVal=vbValues[1];
        tr.CH3.nVal=vbValues[2];
    }
    
    // save tree value to Registry.
    if(GetNBox(tr,dlgName))
    {
        vbValues.SetSize(0);
        vbValues.Add(tr.CH1.nVal);
        vbValues.Add(tr.CH2.nVal);
        vbValues.Add(tr.Ch3.nVal);
        if(!save_default_checkboxes(dlgName,vbValues,valueName))
                printf("failed to save user's choice\n");
                
    }
    else
        printf("usr click cancel\n");
        
}

Remark

this function is usually used with load_default_checkboxes function to load or save values from or to registry. Usr can see results from windows registry editor.

See Also

load_default_checkboxes

header to Include

origin.h

Reference