1

CListCtrl派生クラスで機能するコンテキストメニューを取得しようとしています。OnContextMenuメソッドを作成しましたが、呼び出されていません。私は何が欠けていますか?Visual Studio 2008を使用して、CDialogベースのMFCアプリケーションを作成しています。

CustomList.h

class tcCustomListCtl : public CListCtl
{
    DECLARE_DYNAMIC(tcCustomListCtl)

public:
    tcCustomListCtl();
    virtual ~tcCustomListCtl();

protected:
    DECLARE_MESSAGE_MAP()

    afx_msg void OnContextMenu(CWnd* pWnd,CPoint pos );
};

CustomList.cpp

// tcFaultListCtl
IMPLEMENT_DYNAMIC(tcCustomListCtl, CListCtrl)

tcCustomListCtl::tcCustomListCtl()
{
}

tcCustomListCtl::~tcCustomListCtl()
{
}

BEGIN_MESSAGE_MAP(tcCustomListCtl, CListCtrl)
END_MESSAGE_MAP()

// tcCustomListCtl message handlers
afx_msg void tcCustomListCtl::OnContextMenu(CWnd* pWnd,CPoint pos )
{
  TRACE("tcCustomListCtl::OnContextMenu\n");
}
4

1 に答える 1

2

ON_WM_CONTEXTMENU() をメッセージ マップに追加する必要があることがわかりました。

于 2010-02-05T15:57:19.550 に答える