News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

beginner having trouble with arrays

Started by chipbug, July 05, 2010, 04:56:09 PM

Previous topic - Next topic

chipbug

I have an array:

LOCAL buffer1[1024]:DWORD

it is loaded with integers that specify the item numbers of selected items in a multiple-selection list box:

invoke SendMessage,hLB1,LB_GETSELITEMS,SelCount1,addr buffer1

The SelCount1 variable is retrieved elsewhere in the code with the number of items selected.

I'm trying to get those index numbers one by one to get the text stored in the list box:

    PUSH edi
    PUSH esi
    mov esi, SelCount1
    mov temp,esi
    mov row, 2
    mov column, 1

    MyLoop:
        mov edi,buffer1[temp]
        mov selectedIndex, edi                          ;this is giving me error A2029: multiple base registers not allowed
        invoke SendMessage,hLB1,LB_GETTEXT,selectedIndex,cellValue
        invoke putCell,row,column,ADDR cellValue
        add row, 1
        sub temp, 1
        .if temp > 0
            jmp MyLoop
        .endif
    POP esi
    POP edi


What am I doing wrong?


David

jj2007

David, I can only guess that
mov edi,buffer1[temp]
refers to something like
mov edi, [ebp+n1[ebp+n2]]
Use a register for temp, and it should work.

chipbug

I was moving the number in esi into a variable because my putCell procedure was trashing the esi register. I changed that procedure to push and pop esi and now the loop works correctly using the register instead of the variable:

    PUSH edi
    PUSH esi
    mov esi, SelCount1
    mov row, 2
    mov column, 1

    MyLoop:
        mov edi,buffer1[esi]
        mov selectedIndex, edi
        invoke SendMessage,hLB1,LB_GETTEXT,selectedIndex,cellValue
        invoke putCell,row,column,ADDR cellValue
        add row, 1
        sub esi, 1
        .if esi > 0
            jmp MyLoop
        .endif
    POP esi
    POP edi


Thanks for the suggestion!

Now I just gotta play with it some more to make the  invoke SendMessage,hLB1,LB_GETTEXT,selectedIndex,cellValue work correctly.

David