I'm experiencing a new problem. The right-click event never fires...when I test for it in the event editor, it thinks the other two events are firing. What am I doing wrong?
Code:
LRESULT CALLBACK DLLExport WindowProc(fprh rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
LPRDATA rdPtr = NULL;
switch (nMsg) {
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case TVN_SELCHANGED:
if (((rdPtr = GetRdPtr(((LPNMHDR)lParam)->hwndFrom, rhPtr)) != NULL) && (IDENTIFIER == rdPtr->rHo.hoIdentifier))
{
//rdPtr->dwLastSelChangedLoopNumber = rhPtr->rh4.rh4EventCount;
rdPtr->dwEvtFlags |= EVTFLAG_ONSELCHANGED;
return REFLAG_MSGHANDLED;
}
case NM_DBLCLK:
if (((rdPtr = GetRdPtr(((LPNMHDR)lParam)->hwndFrom, rhPtr)) != NULL) && (IDENTIFIER == rdPtr->rHo.hoIdentifier))
{
//rdPtr->dwLastDoubleClickedLoopNumber = rhPtr->rh4.rh4EventCount;
rdPtr->dwEvtFlags |= EVTFLAG_ONDOUBLECLICKED;
return REFLAG_MSGHANDLED;
}
case NM_RCLICK:
if (((rdPtr = GetRdPtr(((LPNMHDR)lParam)->hwndFrom, rhPtr)) != NULL) && (IDENTIFIER == rdPtr->rHo.hoIdentifier))
{
POINT sMouse;
TVHITTESTINFO hTest;
HTREEITEM hItem;
GetCursorPos(&sMouse);
ScreenToClient(rdPtr->hWnd, &sMouse);
hTest.pt.x = sMouse.x;
hTest.pt.y = sMouse.y;
hTest.flags = TVHT_ONITEMRIGHT;
hItem = TreeView_HitTest(rdPtr->hWnd, &hTest);
if (hItem != NULL)
TreeView_SelectItem(rdPtr->hWnd, hItem);
rdPtr->dwEvtFlags |= EVTFLAG_ONRIGHTCLICKED;
return REFLAG_MSGHANDLED;
}
default:
break;
}
default:
break;
}
return 0;
}