pwnium Posted July 17, 2018 Posted July 17, 2018 Hello there ! how to write a program add two numbers and print the result in text box in order to print the result we can use SetDlgItemText Funtion , the problem is i don't know how to add two numbers .. what functions we need ? am using MASM32 , and RadASM IDE Regards,
Predator Posted July 17, 2018 Posted July 17, 2018 suppose we have to add 20 and 15, you must move the numbers into register, call addition and push it MOV EAX, 20 MOV EBX, 15 ADD EAX,EBX PUSH EAX The result is in EAX bye Predator 1
Nemo Posted July 17, 2018 Posted July 17, 2018 (edited) here's a good example.. Program to sum two numbers it kind of depends on what numbers you want to add, base 16(hex) , base 10(normal)... if it is base 10 you need to convert to hex first add then convert result back to base 10.. Edited July 17, 2018 by Nemo
pwnium Posted July 17, 2018 Author Posted July 17, 2018 i want to add two numbers , base 10 can you give me an example of coverting base 10 to hex ! what functions we need to do that ?
pwnium Posted July 17, 2018 Author Posted July 17, 2018 2 hours ago, Predator said: suppose we have to add 20 and 15, you must move the numbers into register, call addition and push it MOV EAX, 20 MOV EBX, 15 ADD EAX,EBX PUSH EAX The result is in EAX bye Predator my man ! am not working with console applications ! this is simple , 20 + 15 , i want the user to choose those two numbers if you know what i mean
sama Posted July 17, 2018 Posted July 17, 2018 (edited) invoke GetDlgItemInt,Hwnd,IDC_Edit1,0,FALSE push eax invoke GetDlgItemInt,Hwnd,IDC_Edit2,0,FALSE pop ebx add ebx,eax result is in EBX just format it and print it out edit: Remarks The GetDlgItemInt function retrieves the text of the specified control by sending the control a WM_GETTEXT message. The function translates the retrieved text by stripping any extra spaces at the beginning of the text and then converting the decimal digits. The function stops translating when it reaches the end of the text or encounters a nonnumeric character. The GetDlgItemInt function returns zero if the translated value is greater than INT_MAX (for signed numbers) or UINT_MAX (for unsigned numbers). https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getdlgitemint Edited July 17, 2018 by sama info about GetDlgItemInt 1
pwnium Posted July 17, 2018 Author Posted July 17, 2018 3 hours ago, sama said: invoke GetDlgItemInt,Hwnd,IDC_Edit1,0,FALSE push eax invoke GetDlgItemInt,Hwnd,IDC_Edit2,0,FALSE pop ebx add ebx,eax result is in EBX just format it and print it out edit: Remarks The GetDlgItemInt function retrieves the text of the specified control by sending the control a WM_GETTEXT message. The function translates the retrieved text by stripping any extra spaces at the beginning of the text and then converting the decimal digits. The function stops translating when it reaches the end of the text or encounters a nonnumeric character. The GetDlgItemInt function returns zero if the translated value is greater than INT_MAX (for signed numbers) or UINT_MAX (for unsigned numbers). https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getdlgitemint thank you so much ! this is helpful
Predator Posted July 24, 2018 Posted July 24, 2018 On 7/17/2018 at 2:07 PM, abdelhamid said: my man ! am not working with console applications ! this is simple , 20 + 15 , i want the user to choose those two numbers if you know what i mean Sorry bro, you are right.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now