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

<Note>
  This method is implemented in FRE for Windows.
</Note>

This method restores the contents of the [ImageDocument](/fine-reader/engine/api-reference/image-related-objects/imagedocument) 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](/fine-reader/engine/api-reference/supplementary-objects-and-methods/handle#handleasint64) property of the Handle object returned by the [IImageDocument::SaveToMemory](/fine-reader/engine/api-reference/image-related-objects/imagedocument/savetomemory-method) method.

## Syntax

### C++

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

### C\#

```csharp theme={null}
IImageDocument LoadImageDocFromMemory( Int64 HGlobal);
```

### Visual Basic .NET

```vb theme={null}
Function LoadImageDocFromMemory( HGlobal As Int64 ) As IImageDocument
```

## 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](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties). 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](/fine-reader/engine/api-reference/image-related-objects/imagedocument) object.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FineReader Engine functions](/fine-reader/engine/api-reference/return-codes).

## 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](/fine-reader/engine/api-reference/engine-loaders/outprocloader) object.

## See also

[Engine](/fine-reader/engine/api-reference/engine-object-iengine-interface)

[IImageDocument::SaveToMemory](/fine-reader/engine/api-reference/image-related-objects/imagedocument/savetomemory-method)
