ImageMan DLL Suite Version 8Submit feedback on this topic   

ImgOptionValue

int ImgOptionValue(HANDLE hImage, LPSTR lpName, LPSTR lpBuff, DWORD* pdwType, DWORD* cxBuff)

R eturns the value for a given option.

 

Parameter

Type

Description

hImage

HANDLE

Handle of the Image

lpName

LPSTR

Name of the option to retrieve a value for.  Compression

lpBuff

LPSTR

Pointer to a buffer to be filled in with the corresponding value.

pdwType

DWORD

Type of data contained in the Buffer.

cxBuff

DWORD

Size of the buffer being passed in, and if IMG_NOMEM is returned it contains the size of the buffer needed.

 

Return Value

Value

Description

IMG_NOMEM

Not enough memory in lpBuff, cxBuff will return amount needed.

IMG_NOTAVAIL

This value is not available in the given option block

IMG_BAD_PARAM

Bad parameters passed into function, check that cxBuff or pdwType is not NULL

IMG_INV_POINTER

Bad parameters passed into function, check that lpBuff is a valid pointer.

IMG_OK

Value is available in buffer.

 

Example

HANDLE hOptRet = NULL;

.

.

hOptRet =ImgXOptBlkCreate();

char *buff = new char[BUFFSIZE];

DWORD cxBuff = BUFFSIZE;

 

  LPSTR lpName = strtok(lpOptionNames, "|");

 

  while (lpName) {

  DWORD cxSize = cxBuff;

 

int nRet = ImgOptionValue(m_hSrcImg, lpName, buff, &cxSize);

 

  if (IMG_NOMEM == nRet) {

  cxBuff = cxSize;

  delete [] buff;

  buff = new char[cxBuff];

  nRet = ImgOptionValue(m_hSrcImg, lpName, buff, &cxSize);

  }

 

  if (IMG_OK == nRet) {

  ImgXOptBlkAdd(hOptRet, lpName, buff, cxSize);

  }

  lpName = strtok(NULL, "|");

  }

Comments

If you pass in Null for lpBuff or cxBuff = 0 to this function it will return IMG_NOMEM, and cxBuff will tell you how big the buffer needs to be.

 

 

 


© 1995-2004 Data Techniques, Inc. All rights reserved.