> ## 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.

# LoadImageDocFromMemory Method of the Engine Object

This method restores the contents of the [**ImageDocument**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/imagedocument.md) object from the global memory. The method takes as an input parameter an HGLOBAL handle of the memory block from where the object's contents should be loaded. This handle should be obtained from the [**HandleAsInt64**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/handle.md#handleasint64) property of the **Handle** object returned by the [**IImageDocument::SaveToMemory**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/imagedocument-savetomemory.md) method.

The method can be used for passing images between different processes.

## Syntax

```cpp C++ theme={null}
HRESULT LoadImageDocFromMemory(
  __int64          HGlobal,
  IImageDocument** Result
);
```

```csharp C# theme={null}
ImageDocument LoadImageDocFromMemory( Int64 HGlobal);
```

```vb Visual Basic .NET theme={null}
Function LoadImageDocFromMemory( HGlobal As Int64 ) As ImageDocument
```

## Parameters

**hGlobal**

\[in] This parameter specifies the HGLOBAL handle of the memory block from where the object's contents should be loaded. The handle is passed as [**\_\_int64**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/properties.md). This handle should be obtained from the **IImageDocument::SaveToMemory** method, and should be valid (not freed).

**result**

\[out, retval] A pointer to **IImageDocument\*** pointer variable that receives the interface pointer of the resulting [**ImageDocument**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/imagedocument.md) object. Must not be NULL.

## 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).

## Remarks

* The size of the memory area that the object allocates can be obtained by calling the **GlobalSize** function.
* This method does not work if the **Engine** object is created using the [**OutprocLoader**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/outprocloader.md) object.

## See also

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

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