i need some help. i have edit boxes and i use GetDlgItemText to get the text in the two edit boxes and i place them into variables i declared as: Var1 db 20 dup(?) Var2 db 20 dup(?) ;compare code invoke GetDlgItemText,hWnd,FEILD_ONE,Var1,20 ;get first feild invoke GetDlgItemText,hWnd,FEILD_TWO,Var2,20 ;get second feild invoke lstrcmp,addr Var1,addr Var2 .IF ax==0 invoke SetDlgItemText,hWnd,FEILD_COMP,addr Yes ;yes they are this code seems to crash my prog any help on comparing the two variables would be greatly appreciated. thanx -brad
Posted on 2000-12-31 22:29:00 by rage9
The first level of simple debug you can do is to comment out portions of code where you think the bug may lie. Then recompile, run and see. If the bug is gone, let code come back in small dribbles to see which line is actually causing the fault. Message boxes can also emit useful info. Ultimately, you can build up a nice file of things to debug with and just include it in your project's early stages.
Posted on 2001-01-01 01:20:00 by Ernie
Glaring errors Var1 db 20 dup(?) Var2 db 20 dup(?) ....... invoke GetDlgItemText,hWnd,FEILD_ONE,Var1,20 ;get first feild invoke GetDlgItemText,hWnd,FEILD_TWO,Var2,20 ;get second feild invoke lstrcmp,addr Var1,addr Var2 Should be: invoke GetDlgItemText,hWnd,FEILD_ONE,addr Var1,20 ;get first feild invoke GetDlgItemText,hWnd,FEILD_TWO,addr Var2,20 ;get second feild
Posted on 2001-01-01 04:33:00 by Iczelion
Var1 db 20 dup(?) Var2 db 20 dup(?) ....... invoke GetDlgItemText,hWnd,FEILD_ONE,addr Var1,20 invoke GetDlgItemText,hWnd,FEILD_TWO,addr Var2,20 mov esi, offset Var1 mov edi, offset Var2 mov ecx, 20 cld repe cmpsb jne @@ne ;here jump where not equal ;here we get if equal
Posted on 2001-01-01 06:17:00 by isumenko
isumenko your comparison routine has a flaw. It will work correctly IF both strings are exactly 20 bytes in size. If the strings are less than 20 bytes, the result may be wrong even if the strings are identical. This is because even if both strings are null-terminated, your routine still goes on comparing the bytes following the nulls.
Posted on 2001-01-01 10:48:00 by Iczelion
You're right.. But in that example there were two variables with 20 byte length.. :)
Posted on 2001-01-01 14:35:00 by isumenko
besides.. I understood that.. Sorry, I was wrong.. :-(
Posted on 2001-01-01 14:37:00 by isumenko