# CreateMsg

### int CreateMsg(short nStream, short nFunction, short nWbit)

새로운 SECS 메시지 객체를 생성합니다. `SnFnW` 형식(Stream, Function, Wait bit)을 지정하여 메시지 작성을 시작하며, 성공 시 해당 메시지를 핸들링할 수 있는 고유 Message ID를 반환합니다.

Parameters

<table data-header-hidden><thead><tr><th width="200"></th><th width="149"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td>nStream</td><td>short</td><td>메시지의 Stream 번호 (Sn)</td></tr><tr><td>nFunction</td><td>short</td><td>메시지의 Function 번호 (Fn)</td></tr><tr><td>nWbit</td><td>short</td><td>Wait Bit 설정 (1: 응답 대기, 0: 응답 불필요)</td></tr></tbody></table>

```csharp
// 예: S1F1 (Are You There?) 메시지 생성 (Wait Bit = 1)
short stream = 1;
short function = 1;
short wBit = 1;
string strMODELNAME = "Model_1",strSOFTREV = "V.14.1.2";

int lMsgId = m_gem.CreateMsg(stream, function, wBit);
m_gem.OpenListItem(lMsgId);
m_gem.AddAsciiItem(lMsgId, strMODELNAME, strMODELNAME.Length);
m_gem.AddAsciiItem(lMsgId, strSOFTREV, strSOFTREV.Length);
m_gem.CloseListItem(lMsgId);
m_gem.SendMsg(lMsgId);

```


---

# 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/undefined-4/createmsg.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.
