enumRegValue

Syntax

int enumRegValue(int index, lpsz szValueName, int maxValueNameLen, int *piType, int *pcbData)

Arguments

index
is the zero-based index for the next value name to be retrieved
szValueName
is a character string buffer to receive the value name
maxValueNameLen
is the size of the szValueName buffer in bytes (including room for the terminating null character)
piType
is the address of an int variable which will receive a code indicating the type of data associated with this value (REG_DWORD for 32-bit integer data, REG_SZ for character string data, REG_BINARY for byte sequence data)
pcbData
is the address of an int variable which will receive the size in bytes of the data associated with this value

Return

Returns ERROR_SUCCESS if the operation was successful, otherwise it returns one of the following integer error codes:
ERROR_SUCCESS(==0) no error
ERROR_FILE_NOT_FOUNDkey or value name not found
ERROR_MORE_DATAbuffer wasn't big enough (e.g., getRegString, getRegData)
ERROR_NO_MORE_ITEMSindex >= # of values or subkeys (enumRegValue, enumRegSubKey)
ERROR_INVALID_FUNCTIONbad top-level key, etc
ERROR_INVALID_DATAwrong data type or size (or size > 2048)
ERROR_BADDBregistry database is corrupt
ERROR_BADKEYregistry key is invalid
ERROR_CANTOPENregistry key could not be opened
ERROR_CANTREADregistry key could not be read
ERROR_CANTWRITEregistry key could not be written
ERROR_REGISTRY_CORRUPTregistry is corrupt
ERROR_REGISTRY_IO_FAILEDinput/output to registry failed
ERROR_KEY_DELETEDIllegal operation attempted on a Registry key which has been marked for deletion.
ERROR_KEY_HAS_CHILDRENcannot delete a key with subkeys (Windows NT)

Description

Enumerates the names of all values stored under the current key.

Example

// fetches installed fonts from the registry and loads them into a combobox
// (modified example, original by Alex Hunter)

%fml

ctl[0]: combobox,"Style 1\nStyle 2\nStyle 3",pos=(*,10),size=(99,50),val=0,Action=PREVIEW
ctl[1]: pushbutton, "Populate Font List", size=(80,15), pos=(*,35)

int iRetVal;
int iDataType;
int iDataLen;

OnCtl(n):{

if (n==1 && e== FME_CLICKED){

setCtlText(0, ""); //clear the ComboBox control

getRegPath(str9, 256);   //save current registry path
Info("path=%s",str9);

setRegRoot(HKEY_LOCAL_MACHINE);
setRegPath("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts");

getRegPath(str0, 256);   //save current registry path
Info("path=%s",str0);

for (i=0, iRetVal=ERROR_SUCCESS; iRetVal == ERROR_SUCCESS; i++) {

	iRetVal = enumRegValue(i, str0, 256,&iDataType, &iDataLen);

	if (i<21){Info("i=%i, iRetVal=%i,value=%s",i,iRetVal,str0);}

	if (iRetVal == ERROR_SUCCESS) {
            setCtlItemText(0,i,str0);
	}
}
    setRegPath(str9);    //restore registry path to original value
}

return false;
}

Also see

getRegRoot, setRegRoot, getRegPath, setRegPath