프로그래밍/MFC
사용자 정의 메시지
에어버스
2018. 12. 2. 13:37
사용자 정의 메시지
1
2
3
4
5
6
7
8
9
10
11 |
const UINT g_nRegMsg = RegisterWindowMessage("MyMsg"); // 반드시 전역변수로 해야한다.
BEGIN_MESSAGE_MAP(CWBChatView, CView)
...
ON_REGISTERD_MESSAGE(g_nRegmsg, OnRegMsg)
END_MESSAGE_MAP()
LRESULT CWBChatView::OnRegMsg(WPARAM wParam, LPARAM lParam)
{
return 0L;
} |
cs |
보통 WM_USER+1 등으로 상수를 지정하면 다른 프로그램과 중복으로 인한 충돌 위험이 있어 RegisterWindowMessage()를 사용한다.