MFC에서 연속적으로 연결된 resource id들의 command에 대해서
하나의 function으로 처리할 수 있는 macro....
ON_COMMAND_RANGE(id1, id2, memberFxn )
Parameters
Remarks
The range of IDs starts with id1 and ends with id2.
Use ON_COMMAND_RANGE to map a range of command IDs to one member function. Use ON_COMMAND to map a single command to a member function. Only one message-map entry can match a given command ID. That is, you can't map a command to more than one handler. For more information on mapping message ranges, see Handlers for Message-Map Ranges.
There is no automatic support for message map ranges, so you must place the macro yourself.
Example
// The code fragment below shows how to use ON_COMMAND_RANGE macro
// to map a contiguous range of command IDs to a single message // handler function (i.e. OnRangeCmds() in the sample below). In // addition, it also shows how to use CheckMenuRadioItem() to check a // selected menu item and makes it a radio item. BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) ON_COMMAND_RANGE(ID_COMMAND_RANGECMD1, ID_COMMAND_RANGECMD3, &CChildFrame::OnRangeCmds) END_MESSAGE_MAP() void CChildFrame::OnRangeCmds(UINT nID) { CMenu* mmenu = AfxGetMainWnd()->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(5); submenu->CheckMenuRadioItem(ID_COMMAND_RANGECMD1, ID_COMMAND_RANGECMD3, nID, MF_BYCOMMAND); }
'삽질' 카테고리의 다른 글
STL에서 동적할당 pointer 삭제 루틴. (0) | 2011.10.31 |
---|---|
[ListCtrl] 아이템 외부 선택 - SetSelectionMark(), SetItemState(), SetFocus() (0) | 2011.10.15 |
Oracle 3개 Table 조인 (0) | 2011.10.13 |
STL map에서 람다를 활용한 value 찾기 (0) | 2011.10.11 |
[펌] MFC 메시지 리플렉션 (0) | 2011.10.10 |
|
댓글0
댓글을 달아 주세요