Example, Mtmicrgetsectioncount – MagTek Excella STX99875340 User Manual

Page 44

Advertising
background image

Excella Windows API Specifications

34

Example


#define BUFFER_LEN 512

// DocInfo is returned by the MTMICRProcessCheck()
#define BUFFER_LEN 4096

GET_IMAGE getImages [4];
DWORD dwSize = BUFFER_LEN;
char szData [BUFFER_LEN];
DWORD dwStatus;

for (int i = 1; i < 5; i++) {
// Get the image size for image number i

dwStatus = MTMICRGetIndexValue (DocInfo, ”Image Info”, ”Image Size”, i, szData,
& dwSize);

if (dwStatus == MICR_ST_OK) {

// Convert the size to integer
dwSize = atol (szData);
if (dwSize < = 0)
continue;

dwSize = BUFFER_LEN;


// Get the image id

dwStatus = MTMICRGetIndexValue (DocInfo, ”Image Info”, ”Image URL”, i,
szData, & dwSize);

if (dwStatus == MICR_ST_OK)) {

char *p = (char *) malloc (strlen (szData)+1);
getImages [i-1].pcImageId = p;

strcpy (getImage [i-1]. pcImageId, szData);
getImages [i-1].dwBufferLength = bufferSize;
getImages [i-1].pcBuffer =
(char *) VirtualAlloc (NULL, getImages [i-1].dwBufferLength,

MEM_COMMIT,

PAGE_READWRITE);

}

}
}
// Use function MTMICRGetDevice to get device name for variable “Device”
error = MTMICRGetImages (Device, getImages, 4);

MTMICRGETSECTIONCOUNT

MTMICRGetSectionCount function returns the number of section present in a null terminated buffer which contains a set of
key/value pairs. The key/value pairs get stored in the buffer using function MTMICRSetValue or MTMICRSetIndexValue.

ULONG MTMICRGetSectionCount (

char

*pcData,

DWORD

*pdwSectionCount

);

Advertising