MagTek IMAGESAFE99875500 User Manual
Page 39
.................................................................................................................... Section 3. ImageSafe API
31
Remarks
If the function succeeds MICR_ST_OK is returned.
If pcSettings is NULL, MICR_ST_BAD_DATA is returned.
If data in pcSettings string is not in XML format, MICR_ST_ERR_LOAD_XML is returned.
If there is problem using MSXML, MICR_ST_ERR_GET_DOM_POINTER is returned
If pdwKeySize is NULL, error MICR_ST_BAD_BUFFER_LENGTH is returned
If the value of pdwSectionNameSize is not big enough to hold the name of requested section,
MICR_ST_NOT_ENOUGH_MEMORY is returned
Example
char Settings [4096];
char DocInfo [4096];
char device[4096] ="";
DWORD SettingsBufferSize, DocInfoSize, valueSize, dwStatus , dwCount, nIndex ;
char cValue [1024];
DocInfoSize = 4096;
char szSectionName [128];
DWORD dwSize = 128;
// Use function MTMICRGetDevice to get device name for variable “device”
// Call MTMICRProcessCheck function to process a document.
If ( MTMICRProcessCheck (device, Settings, DocInfo, &DocInfoSize) == MICR_ST_OK) {
// Let us scan through all the key pair values returned in the DocInfo
// Get total number of sections
if (MTMICRGetSectionCount (DocInfo, &dwSectionCnt) ==MICR_ST_OK) {
for (nIndex = 0; nIndex < dwSectionCnt; nIndex++){
If (MTMICRGetSectionName(DocInfo, nIndex, szSectionName, &dwSize ==
MICR_ST_OK) {
// Get number of total keys which belong to section
DWORD keyCount;
if (MTMICRGetKeyCount (DocInfo, szSectionName, &keyCount) == MICR_ST_OK){
// Get name of each key
for (int keyIndex = 0; keyIndex < keyCount; keyIndex++) {
char szKeyName [128];
dwStatus = MTMICRGetKeyName(DocInfo, szSectionName, keyIndex,
szKeyName, & dwSize);
if (dwStatus == MICR_ST_OK)
{
// We now have the section and key, let get the value
char szValue [1024];
dwStatus = MTMICRGetValue(DocInfo, szSectionName, szKeyName,
szValue, & dwSize);
if (dwStatus == MICR_ST_OK)
{
}
}
}
}
}
}
}