Click here to Skip to main content
15,888,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am able to handle the mouse move events and get the mouse coordinates on the dialog; but when the mouse moves inside a ClistBox, I am not able to get the coordinates. Could you please help?

What I have tried:

I am able to get the mouse coordinates when I move the mouse on the dialog; but once the mouse enters the clistbox control, I dont get any message in the OnMouseMove function(); that is expected. But, then how am i supposed to get the mouse coordinates on the listbox?
Posted
Updated 1-Jan-17 4:18am

1 solution

I am writing this answer so that others can get help in case some one else is facing this problem. First things first; you can't directly handle mouse move messages from Clistbox. So, you create a new class based on ClistBox class and then handle OnMouseMove() in that class.Then, inside that OnMouseMove() function you should get the item in the clistbox based on the mouse coordinates (as mentioned by IInspectable).

For code example; see below.

C++
BOOL b;
int n = ItemFromPoint(point,b);
CString str;
GetText( n,str);
AfxMessageBox(str);


I guess similar solution should work for other controls like CButton etc.
Hope, this helps.
 
Share this answer
 

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