I am having troble with the subject message. After the invoke eax contains 0FFFFFFFFH (error), _ArgSafe0 contains 0.

Does anyone know how to make this message work?



mov edi,!ListBox
invoke SendMessage, dword ,LB_GETSELITEMS,1,_ArgSafe0
mov eax,[_ArgSafe0]
mov [_Tmp1],eax
mov eax, dword [_Tmp1]
mov ,eax
Posted on 2003-09-03 22:09:54 by msmith
msmith
why dword ?
and why , _ArgSafe0?
afaik
...

LOCAL buffer:DWORD ; or LOCAL buffer[...]:DWORD for more one items
invoke SendMessage, hwndLB, LB_GETSELITEMS, 1, addr buffer
cmp eax,LB_ERR ; LB_ERR == -1
jz @@SendMessageError
...
Posted on 2003-09-03 22:47:46 by P2M
Hi P2M,

This is a snippet of compiler output.

is the descriptor entry of the listbox's handle.

_ArgSafe0 is a dword variable allocated by the compiler intended to receive the result of the function.

These are not issues to the problem at hand. This template works for many messages.

The issue is what do I have to do to make the subject message work.

In other words, your example is equivalent to mine.
Posted on 2003-09-03 22:52:59 by msmith

The return value is the number of items placed in the buffer. If the list box is a single-selection list box, the return value is LB_ERR.


Here is my problem. My listbox IS a single-selection list box.

Now the question is: what function returns the selected item index of a single-selection list box?
Posted on 2003-09-03 23:43:55 by msmith
The correct function is: LB_GETCURSEL

Now it works fine.
Posted on 2003-09-03 23:50:02 by msmith