InsertMODCAPageMem Method

 

Description

Inserts a DIB image as a new page into an existing MO:DCA file in memory. The memory must be allocated using the Windows GlobalAlloc function, with the GMEM_MOVEABLE flag.

 

To create a new MO:DCA file,  you can allocate 1 byte of memory and pass it to the InsertMODCAPageMem function, but it is more efficient to create multi-page MO:DCA files using the CreateMODCAFileMem, AddMODCAPage, CloseMODCAFileMem functions.

 

This function should not be used on handles returned by the CreateMODCAFile / CreateMODCAFileMem functions. Use the AddMODCAPage function for handles created using the CreateMODCAFile or CreateMODCAFileMem function.

Syntax

Result = [BITIFF.] InsertMODCAPageMem GlobalMemory Size, InserBeforePage, Dib, Compression, Quality

Parameters

GlobalMemory

LONGLONG

Handle to a MO:DCA file in memory. The memory must be allocated using the Windows GlobalAlloc function, with the GMEM_MOVEABLE flag. To create a new MO:DCA file, allocate 1 byte.

 

Size

Long

The size of the MO:DCA file. The new size is not returned by the function, use the GlobalSize Windows function to retrieve the new size.

 

InsertBeforePage

Long

0-based page number. The new page is inserted before the specified page. If -1 is specified, the new page is inserted after the last page.

 

Dib

LONGLONG

Handle to a DIB image.

 

Compression

Long

The compression to use. The following compression types are supported:

 

 

 

·         1: IBM MMR (1 bit)

·         3: Not compressed (1 bit)

·         128: CCITT Group 3, 1 Dimensional (1 bit)

·         129: CCITT Group 3, 2 Dimensional (1 bit)

·         130: CCITT Group 4 (1 bit)

·         131: JPEG (8 bit grayscale or 24 bit)

 

 

Quality

Long

Compression quality. It is only used by the JPEG compression type. The value must be between 1 and 99.

Return Value

Zero on success, or an error code on failure. For the possible error codes, please see the BiTiff.ocx error codes.