SaveMemory method (Main Control)

Visual Basic example
Visual C++ 4.0 example

Access 2.0 example

Access 95, 97 example
Visual J++ example

Syntax short SaveMemory (OLE_HANDLE* phMem, short iFormat, short iBitsPerPixel, short iQuality, long* piSize);

Overview:  Refer to Using Memory-Resident Image Files.

Remarks

Saves a bitmap to a file in memory. The output can be in any of the supported compressed or uncompressed file formats.

To use this method, do the following:

1. Declare a variable of the appropriate data type to reference the file in memory. You can then pass its address (pass the variable by reference) in this method, which will allocate the memory, save the bitmap, and unlock the memory.

2. Declare a long integer variable for the file-size. You can then pass its address in this method, which will update its value with the size of the file.

3. Call this method to save the bitmap in the specified memory handle.

To see the correct data types, refer to the code example for your development system.

To get information about a file stored in memory, refer to the GetMemoryInfo method. To load an image from a file in memory, refer to the LoadMemory method.

To load an image from a file in memory, use one of the following methods:

LoadMemory—use this for a global handle to the file in memory

LoadArray—use this for a VARIANT byte array that contains the file in memory

LoadBuffer—use this for an address of a memory location that contains the file in memory

To save an image to a memory file, use one of the following methods:

SaveMemory—returns a global handle to a file in memory

SaveArray—returns a VARIANT byte array that contains the file in memory

SaveBuffer—saves a file into a memory location that the user allocates

Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits .

Note: You cannot save a multipage file using the SaveMemory method, but if you get a multipage file into memory in some other way, you can use the LoadMemory method to load a specific page from the file.

See Also

Elements:  Save method, SaveWithStamp method, SaveTileHeight property, SaveTileWidth property

Topics:  Raster Images: Saving Files