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

# AddFromMemory Method of the PDFAttachments Object

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

This method adds a file from the global memory, where it was previously loaded by the user, to the collection of PDF attachments.

## Syntax

### C++

```cpp theme={null}
HRESULT AddFromMemory(
  __int64          HGlobal,
  BSTR             FileName,
  BSTR             Description,
  IPDFAttachment** Result
);
```

### C\#

```csharp theme={null}
IPDFAttachment AddFromMemory(
  Int64  HGlobal,
  string FileName,
  string Description
);
```

### Visual Basic .NET

```vb theme={null}
Function AddFromMemory( _
  HGlobal As Int64, _
  FileName As String, _
  [Description As String = "0"] _
) As IPDFAttachment
```

## Parameters

HGlobal

\[in] Specifies the HGLOBAL handle of the memory block which contains the attachment file. The handle is passed as [\_\_int64](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties). This handle should be valid.

FileName

\[in] Specifies the name of the attachment file. The name must contain file extension.

Description

\[in] Contains a user-defined description of the attachment file. This parameter is optional and may be empty string.

Result

\[out, retval] A pointer to [IPDFAttachment](/fine-reader/engine/api-reference/document-related-objects/pdfattachment)\* pointer variable that receives the interface pointer of the object representing the added attachment.

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

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

[PDFAttachments](/fine-reader/engine/api-reference/document-related-objects/pdfattachments)
