Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am developing a MFC application for Win-xp. It uses CListCtrl. I use a popup menu (right click)to edit any row. A row can also be edited by double clicking that particular row. Every thing was fine with Win-XP.

When I used that application in Win-7, Using the pop-up menu (right clicking) is not working, but the double click option to edit the row is working. On debugging I found that the function for handling this receives '-1' for selected row while using right click.

Has any one of you guys faced similar problem?

Thanks,
Posted
Comments
Richard MacCutchan 22-Jul-11 4:48am    
Check the MSDN documentation for the function you are calling, and the actual error from GetLastError() when it fails.
OlegKrivtsov 22-Jul-11 23:45pm    
To get a selected item in the right-click handler, I would call HitTest() method of the list control. For example, like this:

// Get cursor pos
CRect ptCursor;
GetCursorPos(&ptCursor);
// Hit test
LVHITTESTINFO hti;
hti.pt = ptCursor;
m_list.HitTest(&hti);

then I would determine the item from hti.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900