# CloseMsg

### int CloseMsg(int lMsgId)

기능1: 수신혹은 작성중인 메시지를 Message Queue에서 완전히 삭제함.

해당 함수를 호출하면 lMsgId에 해당하는 메시지가 Message Queue에 더이상 존재하지 않게 됩니다. 사용자가 CloseMsg 해야할 메시지에 대하여 해당 함수를 호출하지 않을 경우 해당 Message는 주기적(10-20분)으로 자동 삭제됩니다.

&#x20;

기능2: lMsgId가 Object(List)형으로 등록된 VID인 경우 해당 VID의 내용을 Clear 함.

Object형 VID의 내용을 갱신할 때 기존의 내용을 완전히 지우는 용도로 사용합니다.

{% hint style="danger" %}
Object 형의 VID를 사용하실 경우에는 반드시 앞에 CloseMsg(VID)를 해주셔야합니다.
{% endhint %}

Parameters

<table data-header-hidden><thead><tr><th width="248" valign="top"></th><th width="82" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Name</td><td valign="top">Type</td><td valign="top">Description</td></tr><tr><td valign="top">lMsgId</td><td valign="top">int</td><td valign="top">삭제할Message ID 혹은 내용을 Clear 할 Object형 VID</td></tr></tbody></table>

```csharp
 m_gem.CloseMsg(4002);      //CloseMsg() 함수를 필수적으로 실행해주셔야 합니다.
 m_gem.OpenListItem(4002);
 {
     m_gem.OpenListItem(4002);
     {
         m_gem.AddI4Item(4002,ECV.m_nLinkInterval);
         m_gem.AddI4Item(4002,ECV.m_nDeviceID);

         m_gem.OpenListItem(4002);
         {
             m_gem.AddI4Item(4002, ECV.m_nT3);
             m_gem.AddI4Item(4002, ECV.m_nT5);
             m_gem.AddI4Item(4002, ECV.m_nT6);
             m_gem.AddI4Item(4002, ECV.m_nT7);
         }
         m_gem.CloseListItem(4002);
     }
     m_gem.CloseListItem(4002);
 }
 m_gem.CloseListItem(4002);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item/closemsg.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
