# Include "stdafx. H "# include <windows. h> # include <windowsx. h> # include "resource. H "# include" maindlg. H "# include <stdlib. h> bool winapi main_proc (hwnd, uint umsg, wparam, lparam) {Switch (umsg) {handle_msg (hwnd, handler, timeout); handle_msg (hwnd, wm_command, main_oncommand); handle_msg (hwnd, wm_close, main_onclose);} return false;} bool main_oninitdialog (hwnd, hwn D hwndfocus, lparam) {return true;} void main_oncommand (hwnd, int ID, hwnd hwndctl, uint codenotasks) {If (idc_close = ID) {main_onclose (hwnd);} If (idc_button1 = ID) {tchar N1 [64]; getwindowtext (getdlgitem (hwnd, idc_edit1), N1, sizeof (N1 )); if (0 = strlen (N1) // whether addend 1 is null {MessageBox (hwnd, text ("addend 1 cannot be blank, please enter it again! "), Text (" warning "), mb_ OK); return;}/* MessageBox (hwnd, N1, text (" 1111 "), mb_ OK ); */tchar N2 [64]; getwindowtext (getdlgitem (hwnd, idc_edit2), N2, sizeof (N2); If (0 = strlen (N2 )) // whether addend 1 is null {MessageBox (hwnd, text ("addend 2 cannot be blank. Please enter it again! "), Text (" warning "), mb_ OK); return;} int d1 = atoi (N1); int D2 = atoi (N2); int ret = D1 + D2; tchar J [128]; wsprintf (J, "% I", RET); setwindowtext (getdlgitem (hwnd, idc_edit3), J);} void main_onclose (hwnd) {enddialog (hwnd, 0 );}