본문 바로가기

Windows/WTL

WM_CONTEXTMENU

[code]
LRESULT OnContextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
    //
    // lParam
    //
    CPoint pt(lParam);
    CRect rc;

    GetClientRect(&rc);
    ClientToScreen(&rc);
    if(rc.PtInRect(pt))
    {
        CMenu menuPopup;
        menuPopup.LoadMenu(IDR_MAINFRAME);
        menuPopup.GetSubMenu(0).TrackPopupMenu(TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON, pt.x, pt.y, m_hWnd);
    }
    else
    {
        SetMsgHandled(false);
    }

    return 0;
}
[/code]

'Windows > WTL' 카테고리의 다른 글

Dialog 작성시  (0) 2013.10.02
BEGIN_UPDATE_UI_MAP (UI 갱신 핸들러 맵)  (0) 2013.10.02
MFC 원형 정보  (0) 2013.10.02
다중 체인 구조  (0) 2013.10.02
체인 구조  (0) 2013.10.02