that was very deep and meaningful kuphryn. but lets help out anyway.
Okay, its sounds like you know how to create the edit boxes and buttons. what you need to do is capture the message that is sent when the button is clicked, and place your code there.
That can be done by checking the LOWORD of the wParam when the WM_COMMAND message occurs, to see if it matches the ID of your button. eg:
Code:
switch (msg)
{
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_BUTTON: //Whatever ID you gave it
//Code here
return 0;
The code will have to ensure that there is text in both controls, then convert it to numbers, and add it together. Then convert the sum back to a string and display it. ie:
Code:
char *str1=new char[256]; //Allocate strings to retrieve the input
char *str2=new char[256]; //ditto
int num1,num2;
GetWindowText(hInput1,str1,255);
GetWindowText(hInput2,str2,255);
//The above lines retrieve the text of the edit controls hInput1 and hInput2
num1=atol(str1); //converts string to long int, needs stdlib.h
num2=atol(str2);
ltoa(num1+num2,str1,10); //convert long int to string. 10 is the radix
SetWindowText(hDisplay,str1); //hDisplay is a control with a caption, ie an edit control
and thats it. ill post a full proggy in a tic.