Bestimmen des Ausgabeformats eines 1.

Im folgenden Beispiel wird das Größenmakro ICCompressGetFormat verwendet, um die Puffergröße zu bestimmen, die für die Daten erforderlich ist, die das Komprimierungsformat angeben, ordnet einen Puffer der entsprechenden Größe mithilfe der GlobalAlloc-Funktion zu und ruft die Informationen zum Komprimierungsformat mithilfe des ICCompressGetFormat-Makros ab.

LPBITMAPINFOHEADER   lpbiIn, lpbiOut; 
 
// *lpbiIn must be initialized to the input format. 
 
dwFormatSize = ICCompressGetFormatSize(hIC, lpbiIn); 
h = GlobalAlloc(GHND, dwFormatSize); 
lpbiOut = (LPBITMAPINFOHEADER)GlobalLock(h); 
ICCompressGetFormat(hIC, lpbiIn, lpbiOut); 
 

Im folgenden Beispiel wird das ICCompressQuery-Makro verwendet, um zu bestimmen, ob eine Maske die Eingabe- und Ausgabeformate verarbeiten kann.

LPBITMAPINFOHEADER   lpbiIn, lpbiOut; 
 
// Both *lpbiIn and *lpbiOut must be initialized to the respective
// formats.
 

if (ICCompressQuery(hIC, lpbiIn, lpbiOut) == ICERR_OK)
{ 
 
    // Format is supported; use the compressor. 
 
}
 
 

Im folgenden Beispiel wird das MAKRO ICCompressGetSize verwendet, um die Puffergröße zu bestimmen, und es ordnet einen Puffer dieser Größe mit globalalloc zu.

// Find the worst-case buffer size. 
dwCompressBufferSize = ICCompressGetSize(hIC, lpbiIn, lpbiOut); 
 
// Allocate a buffer and get lpOutput to point to it. 
h = GlobalAlloc(GHND, dwCompressBufferSize); 
lpOutput = (LPVOID)GlobalLock(h);