001
09.10.2006, 20:56 Uhr
FloSoft
Medialer Over-Flow (Administrator)
|
Hi, NM_RClick-Methode hinzufügen und dort das Menu laden (in meinem Fall Ressource "IDR_TREECTRL_CONTEXTMENU") und erstes Submenü :
C++: |
void CMyDlg::OnNMRclickTree(NMHDR *pNMHDR, LRESULT *pResult) { *pResult = 0;
CMenu Menu; if(Menu.LoadMenu(IDR_TREECTRL_CONTEXTMENU)) { POINT pt, pt2; GetCursorPos(&pt); pt2 = pt; m_Tree.ScreenToClient(&pt2);
UINT uFlags; HTREEITEM hItem = m_Tree.HitTest(pt2, &uFlags);
if ((hItem != NULL) && (TVHT_ONITEM & uFlags)) m_Tree.SelectItem(hItem);
if(hItem) { CMenu* pPopup = Menu.GetSubMenu(0); pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, pt.x, pt.y, this); } } }
|
-- class God : public ChuckNorris { }; |