how can i move the cursor along the items in a listbox "LB_SETCURSEL" when i move the mouse"wm_mosemove", example would be better.............thanks
Hi sudeer,
I would think that you would have to subclass the listbox in order to process the WM_MOUSEMOVE message then use LB_ITEMFROMPOINT on the translated co-ordinates and LB_SETCURSEL to select the item. Not a terribly challenging thing to do so you should be able to figure it out yourself. I'm only at home for the long weekend then back on the road again so it's not likely I would have the time to do an example though.
BTW, why the poll ?
I would think that you would have to subclass the listbox in order to process the WM_MOUSEMOVE message then use LB_ITEMFROMPOINT on the translated co-ordinates and LB_SETCURSEL to select the item. Not a terribly challenging thing to do so you should be able to figure it out yourself. I'm only at home for the long weekend then back on the road again so it's not likely I would have the time to do an example though.
BTW, why the poll ?
I could not figure it out, it is challenging to me, an example would be more than appriciated.
.................tanks
.................tanks
Poll removed.
As I said this is an extremely simple sublclassing problem. Here is a code snippet that will get you started...
I do not use MASM so the code is in GoAsm syntax, you will have to translate it yourself.
Donkey
// Subclass the listbox
invoke SetWindowLong,,GWL_WNDPROC,offset LBHotTrac
mov ,eax
// Your subclassing procedure...
LBHotTrac FRAME hwnd,uMsg,wParam,lParam
.WM_MOUSEMOVE
cmp D,WM_MOUSEMOVE
jne >>
// Get the item under the cursor
invoke SendMessage,,LB_ITEMFROMPOINT,0,
// test to make sure we are in the client area
test eax,0FFFF0000h
jnz >>
// Set the selection to the closest item
invoke SendMessage,,LB_SETCURSEL,eax,0
:
// Call the listbox window proc to process the messages
invoke CallWindowProc,,,,,
RET
ENDF
I do not use MASM so the code is in GoAsm syntax, you will have to translate it yourself.
Donkey
problem solved .................thanks to you