Windows/WTL
WM_CONTEXTMENU
aucd29
2013. 10. 2. 13:49
[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]
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]