> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SaveToMemory Method of the ImageDocument Object

This method saves the contents of the [**ImageDocument**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/imagedocument.md) object into the global memory. The method returns an HGLOBAL handle of the memory area allocated for the object as the [**Handle**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/handle.md) object. This object manages memory allocation and releases resources when they are no longer in use.

The contents of the object can be restored with the help of the [**IEngine::LoadImageDocFromMemory**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/engine-loadimagedocfrommemory.md) method.

## Syntax

```cpp C++ theme={null}
HRESULT SaveToMemory( IHandle** Result );
```

```csharp C# theme={null}
Handle SaveToMemory();
```

```vb Visual Basic .NET theme={null}
Function SaveToMemory() As Handle
```

## Parameters

**Result**

\[out, retval] A pointer to [**IHandle**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/handle.md)\* pointer variable that receives interface pointer of the resulting **Handle** object representing the handle to the associated bitmap.

## Return values

This method has no specific return values. It returns [standard return values of ABBYY FlexiCapture SDK functions](https://docs.abbyy.com/flexi-capture/sdk/api-reference/errorcodes.md).

## See also

[**ImageDocument**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/imagedocument.md)

[**IEngine::LoadImageDocFromMemory**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/engine-loadimagedocfrommemory.md)
