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
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
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
Give it the data. (Code below doesn't have the ADDR operator.)
invoke SetDlgItemInt,hWin,IDC_ML,mlarray,FALSE
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
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
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
(hmm wouldnt let me add this to the other post..odd)
njkt
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
it still doesnt work,
i get the same as before heres the code now,
dono whats up, maybe im just that bad in my code haha
thanks,
njkt
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
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)
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)
the text portion works perfectly as is,
its the integer portion that doesnt.
njkt
its the integer portion that doesnt.
njkt
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?
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
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
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
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
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
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
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
);
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 ;) )
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
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
opps didnt knwo u wanted the .exe again
-edit
heres the .rap
-edit
heres the .rap
lolz i am using radasm
I can't see .RAP file
not sure if I understand you...:confused:
ok i uploaded the .rap its in my previous post
damn.. I just deleted old files (I thinked you sended all the sourse :stupid: )
-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
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
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
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