hey,
i wanna know how to make an integer array,
i have tried but it doesnt work,
im using it in a listbox aswell, using an editbox, listbox, so when they select an item the integer appears on the edit box,
i have this working for strings but it doesnt work for numbers,

this is wat i have,
;the data
monlife0 dd 10
monlife1 dd 15
monlife2 dd 20
;the array
mlarray dd OFFSET monlife0
dd OFFSET monlife1
dd OFFSET monlife2
;the code
invoke SetDlgItemInt,hWin,IDC_ML,addr mlarray,FALSE

that should work but the value i get in the edit box is very large, 4220189
how do i make the array display the values correctly?
(i think its my coding)

thanks,
njkt
Posted on 2003-08-14 14:24:31 by njkt809
SetDlgItemInt doesn't want the address of your integer data.
Give it the data. (Code below doesn't have the ADDR operator.)

invoke SetDlgItemInt,hWin,IDC_ML,mlarray,FALSE
Posted on 2003-08-14 19:37:35 by tenkey
hey,
the problem isnt displaying numbers,
the problem is that the numbers displayed are wrong,
it displays a number thats 4223189 (it changes alot when i compile it at different times)
but it should display 10 for one selection, and another number for the second,
i have no probs with getculsel or anything but the numbers appearing are wrong, and they dont change with the different listbox selection, although the text strings do.

-edit
fixed the numbers so they change with each new selectiong (had to push and pop eax)
but the number problem still persists

njkt
Posted on 2003-08-14 23:18:27 by njkt809
n heres the source, (goto arena when downloaded u'll see whats the problem)
(hmm wouldnt let me add this to the other post..odd)

njkt
Posted on 2003-08-15 00:57:28 by njkt809
Using addr is wrong, since it expands to lea eax, xx. Since lea with mlarray is the same as eax*4+mlarray. Thus you are getting the address of the array you want to access instead of the value. Use mov instead.


mov eax, mlarray[eax*4]
invoke SetDlgItemInt,hWin,IDC_ML,eax,FALSE
Posted on 2003-08-15 01:38:23 by roticv
it still doesnt work,
i get the same as before heres the code now,


.IF ax == LBN_SELCHANGE
invoke SendMessage,lParam,LB_GETCURSEL,0,0
; There has been a new selection made and the item index is in eax
.IF eax != LB_ERR
push eax
invoke SetDlgItemText,hWin,IDC_MONSTAT,Monarray[eax*4]
pop eax

mov eax, mlarray[eax*4]
invoke SetDlgItemInt,hWin,IDC_ML,eax,FALSE

.ENDIF


dono whats up, maybe im just that bad in my code haha
thanks,

njkt
Posted on 2003-08-15 01:47:30 by njkt809
don't look your source carefully
but still i suggest:
monlife0 EQU 10
....
mlarray dd monlife0

invoke SetDlgItemText,hWin,IDC_MONSTAT,Monarray - this shoul'd work
because Monarray pushes value of your Monarray that is really offset (lpString)
Posted on 2003-08-15 02:10:35 by S.T.A.S.
the text portion works perfectly as is,
its the integer portion that doesnt.

njkt
Posted on 2003-08-15 02:14:43 by njkt809

its the integer portion that doesnt.
njkt


take a look on mlarray
it holds offsets not values, so when you push mlarray you REALLY push offset monlife not value
your invoke is OK, but what about mlarray?
Posted on 2003-08-15 02:20:07 by S.T.A.S.
AHHHHHHHHHHH :o
sorry ahahahaa
cant believe i made that fobar
haha it was the offsets that were making the display go weird :o
sorry for all this posts ahahaha,
..whew now i can finish this stupid thing...


thanks,
njkt
Posted on 2003-08-15 02:24:48 by njkt809
try plase mlarray line BEFORE monlife0 dd 10 and no need for ;monster life array

may be it will help you in the future:
1. take a look on numbers you're recived some time ago
for example 4222241=406D21Hex
2. Win32 progs runs from address 400000h
3. coz they are just near! so your previous version showed actual addresses of array numbers
Posted on 2003-08-15 02:25:40 by S.T.A.S.
ok the int works for display,
so then after the display i set it for the next dialog window by using this codes right?

invoke GetDlgItemInt,hWin,IDC_ML,monlife,TRUE ;to get it into the var monlife

;and
;in the next dialog
invoke SetDlgItemInt,hWin,IDC_MONLIFE,monlife,TRUE

this should work right? but it comes up with a 0 instead of the value thats in IDC_ML

thanks,
njkt
Posted on 2003-08-15 02:33:23 by njkt809
The GetDlgItemInt function translates the text of a specified control in a dialog box into an integer value.

UINT GetDlgItemInt(

HWND hDlg, // handle to dialog box
int nIDDlgItem, // control identifier
BOOL *lpTranslated, // points to variable to receive success/failure indicator
BOOL bSigned // specifies whether value is signed or unsigned
);

and returns it in EAX i think

why not use RadASM, so i coud easely compile your prog to debug?:grin:
(i'm to lazy to create it myself, and debugging in mind isn't easy ;) )
Posted on 2003-08-15 02:48:31 by S.T.A.S.
lolz i am using radasm,

oddly enough it works for text, with no problems,
i have it working once,
it will work only once for a weird reason i dono.
it will show the int in the second window,
but if u click the X and try again it will crash.. i dono why.

thanks,
njkt
Posted on 2003-08-15 03:03:46 by njkt809
opps didnt knwo u wanted the .exe again

-edit
heres the .rap
Posted on 2003-08-15 03:07:38 by njkt809
lolz i am using radasm

I can't see .RAP file

not sure if I understand you...:confused:
Posted on 2003-08-15 03:12:10 by S.T.A.S.
ok i uploaded the .rap its in my previous post
Posted on 2003-08-15 03:15:36 by njkt809
damn.. I just deleted old files (I thinked you sended all the sourse :stupid: )
Posted on 2003-08-15 03:20:58 by S.T.A.S.
-edit

ok well about 9 hours of sleep and i figured it out,
i had to push eax, mov the buffer into eax, set the buffer to the value of the editbox then mov the buffer into the variable :-S


thanks for the help,
njkt
Posted on 2003-08-15 03:27:10 by njkt809
now how would i mov the vlaue of the array into a variable without useing editboxes,
then display it in an edit box on the second window?
i tried but i get 0
this is my code to mov the array so far,

mov eax, mmarray
mov monmoney, eax

thanks,
njkt
Posted on 2003-08-15 13:44:27 by njkt809