The Example code is below:
This is a part of the program above:
When I put it in the position (*****1*****), it does good work, but when I put it in the position (*****2*****), it can also compile,but when I excute the program it errors(memory), Why does this happen?
.if choosenum == 5
(*****1*****)
xor ecx,ecx
mov eax,ecx
mov eax,Count //Get the Count Value before
dec eax
dec eax
invoke SetDlgItemInt,hDlgItem,IDC_one,eax,FALSE
xor ecx,ecx
mov eax,ecx
mov eax,Count
dec eax
dec eax
mov ecx,Size //Get the Size Value before
mul ecx
mov sto1,eax //define sto1 before
add eax,ecx
add eax,ecx
mov sto2,eax //define sto2 before
invoke SetDlgItemInt,hDlgItem,IDC_two,sto1,FALSE
xor eax,eax
mov ecx,eax
mov eax,Count
dec eax
dec eax
mov ecx,100
mul ecx
mov ecx,Count
.if ecx
div ecx
.else
mov eax,0
.endif
invoke SetDlgItemInt,hDlgItem,IDC_three,eax,FALSE
invoke SetDlgItemText,hDlgItem,IDC_four,addr szMsg
(*****2*****)
xor ecx,ecx
mov eax,ecx
mov ecx,sto2
mov eax,dS //Get the dS Value before
sub eax,ecx
invoke wsprintf,addr szBuffer,addr szFmt1,eax
invoke SetDlgItemText,hDlgItem,IDC_five,addr szBuffer
xor ecx,ecx
mov ecx,Count
dec ecx
dec ecx
invoke wsprintf,addr szBuffer,addr szFmt2,ecx
invoke SetDlgItemText,hDlgItem,IDC_six,addr szBuffer
invoke SetDlgItemText,hDlgItem,IDC_seven,addr szMsg2
invoke SetDlgItemText,hDlgItem,IDC_RESULT,addr szMsg3
.endif
This is a part of the program above:
xor ecx,ecx
xor eax,eax
mov ecx,Size
shl ecx,1
mov szTemp,ecx //define szTemp before
xor ecx,ecx
mov eax,ecx
mov eax,200
mov ecx,Count
.if ecx
div ecx
.else
mov eax,0
.endif
invoke wsprintf,addr szBuffer,addr szFmt,szTemp,eax
invoke SetDlgItemText,hDlgItem,IDC_box,addr szBuffer
When I put it in the position (*****1*****), it does good work, but when I put it in the position (*****2*****), it can also compile,but when I excute the program it errors(memory), Why does this happen?