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
Posted on 2008-05-04 02:28:21 by sudeer
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 ?
Posted on 2008-05-16 22:58:12 by donkey
I could not figure it out, it is challenging to me, an example would be more than appriciated.
.................tanks

Posted on 2008-05-17 20:47:51 by sudeer
Poll removed.
Posted on 2008-05-17 23:06:53 by SpooK
As I said this is an extremely simple sublclassing problem. Here is a code snippet that will get you started...

// 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
Posted on 2008-05-18 13:02:56 by donkey
problem solved .................thanks to you
Posted on 2008-05-19 07:49:43 by sudeer