I know that this is a very old question but I wanted to give a straight answer since one was not posted and someone might come looking for an answer...
You need to start by defining a select index, it needs to be signed...
SHORT sSelectIndex;
To find the first item selected you need to set sSelectIndex to return the first item selected...
sSelectIndex = LIT_FIRST;
Then you loop through the lmquery until sSelectIndex is equal LIT_NONE...
while ((sSelectIndex = (USHORT)(ULONG)WinSendMsg(hWndLstBox,
LM_QUERYSELECTION, MPFROMSHORT((SHORT)sSelectIndex), 0L)) != LIT_NONE)
{
CHAR szText[256];
// query list box item for text
WinSendMsg(hWndLstBox,
LM_QUERYITEMTEXT, MPFROM2SHORT(sSelectIndex, sizeof(szText)),
MPFROMP(szText));
printf(szText);
}
I hope someone finds this answer.