troubleshooting Question

*** If you want a challenge, here it is *** Command routing nightmare

Avatar of mrwad99
mrwad99Flag for United Kingdom of Great Britain and Northern Ireland asked on
System Programming
15 Comments1 Solution653 ViewsLast Modified:
Ah hello.

I have a serious issue that is causing major problems.

I have a command handler for a range of IDs on a menu:

ON_COMMAND_RANGE(ID_VIEW_FILTER, MAX_COMMAND_RANGE,  OnViewFilterByPack)

with

#define MAX_COMMAND_RANGE ID_VIEW_FILTER + 31 + NUMBER_OF_ADDITIONAL_ITEMS
#define NUMBER_OF_ADDITIONAL_ITEMS 4

#define ID_VIEW_FILTER                              30000

I have a tree control on my app.  Whenever I complete a drag drop operation on the tree (drag to correct place and release left mouse button), I get a message generated from somewhere that calls OnViewFilterByPack.  This message has ID 30035; obviously falling into the range for this handler.  Now, if I change the value of ID_VIEW_FILTER to 40000, this message has ID 40035.  This in itself might be a clue.

My call stack is (easier to read in Notepad with word wrap off)

>      MyApp.exe!CMyView::OnViewFilterByPack(unsigned int nID=30035)  Line 2025      C++
       mfc71d.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget=0x00c5b1a8, unsigned int nID=30035, int nCode=0, void (void)* pfn=0x0043f8d4, void * pExtra=0x00000000, unsigned int nSig=55, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 103      C++
       mfc71d.dll!CCmdTarget::OnCmdMsg(unsigned int nID=30035, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 396 + 0x27      C++
       mfc71d.dll!CView::OnCmdMsg(unsigned int nID=30035, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 160 + 0x18      C++
       MyApp.exe!CMyView::OnCmdMsg(unsigned int nID=30035, int nCode=0, void * pNewData=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 1151      C++
       mfc71d.dll!CWnd::OnCommand(unsigned int wParam=30035, long lParam=0)  Line 2550      C++
       mfc71d.dll!CWnd::OnWndMsg(unsigned int message=273, unsigned int wParam=30035, long lParam=0, long * pResult=0x0012fcf0)  Line 1759 + 0x1c      C++
       mfc71d.dll!CWnd::WindowProc(unsigned int message=273, unsigned int wParam=30035, long lParam=0)  Line 1745 + 0x1e      C++
       mfc71d.dll!AfxCallWndProc(CWnd * pWnd=0x00c5b1a8, HWND__ * hWnd=0x006c0c0e, unsigned int nMsg=273, unsigned int wParam=30035, long lParam=0)  Line 241 + 0x1a      C++
       mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x006c0c0e, unsigned int nMsg=273, unsigned int wParam=30035, long lParam=0)  Line 389      C++
       mfc71d.dll!AfxWndProcBase(HWND__ * hWnd=0x006c0c0e, unsigned int nMsg=273, unsigned int wParam=30035, long lParam=0)  Line 209 + 0x15      C++
       USER32.DLL!77e3a420()       
       USER32.DLL!77e14605()       
       mfc71d.dll!CWnd::AttachControlSite(CHandleMap * pMap=0x00c58008)  Line 445 + 0x16      C++
       mfc71d.dll!CWnd::FromHandle(HWND__ * hWnd=0x002f0d36)  Line 311      C++
       mfc71d.dll!CWnd::GetTopLevelParent()  Line 2623      C++
       00007553()      
       USER32.DLL!77e15b77()       
       mfc71d.dll!AfxInternalPumpMessage()  Line 188      C++
       mfc71d.dll!CWinThread::PumpMessage()  Line 916      C++
       mfc71d.dll!CWinThread::Run()  Line 637 + 0xb      C++
       mfc71d.dll!CWinApp::Run()  Line 701      C++
       mfc71d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00142db5, int nCmdShow=1)  Line 49 + 0xb      C++
       MyApp.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00142db5, int nCmdShow=1)  Line 25      C++
       MyApp.exe!WinMainCRTStartup()  Line 390 + 0x39      C
       KERNEL32.DLL!7c59893d()       
       mfc71d.dll!CRichEditView::OnKeyDown(unsigned int nChar=, unsigned int nRepCnt=, unsigned int nFlags=)  Line 1030 + 0x8      C++


I cannot see at all where this message is coming from, and am pretty desperate to sort this out ASAP.  The confusing thing is it is generated by the drag drop-LButton up operation.

Does anyone have any ideas on this ?

TIA
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros