Glossary Item Box

ImageMan DLL Suite Version 8 Submit feedback on this topic   

ImgXOptBlkGet

int IMAPI ImgXOptBlkGet (LPSTR lpbuf, LPSTR lpszBuf, DWORD* pdwType, DWORD* cxBuff)

This function is used to retrieve the value for a particular key from an Option Block (OptBlk).

 

Parameter

Type

Description

lpbuf

LPSTR

A pointer to the buffer that you want filled in with the option information.

pdwType

DWORD

Is a pointer to a DWORD to receive the datatype of the item, cxBuf receives the size of the item.

cxBuff

DWORD

Is a pointer to a DWORD to receive the Buffer size needed to retrieve the item.

 

Return Value

Return Value IMG_OK on success.

Comments

To determine the necessary buffer size a NULL pointer can be passed in for lpBuff, or the cxBuff size can be set to 0. When you do this check the return value, if the return value is IMG_NOTAVAIL the option is not available in the given option block. If the return value is IMG_NOMEM, then you can create the necessary buffer and request the data.

Example

 char *buff = NULL;

  DWORD cxBuff = 0;

  DWORD dwType;

 

  int nRet = ImgOptionValue(m_hSrcImg, "Compression", buff, &dwType,

&cxBuff);

  if (IMG_NOMEM == nRet) {

  buff = new char[cxBuff];

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

  }

 

  if (IMG_OK == nRet) {

  // do something with the information returned

  }

 

  if (buff) delete [] buff;

 

 


Copyright 2008 Data Techniques, Inc. All Rights Reserved