Here is the code you wanted..sorry, didn't figure you'd want to have to sit and read it:
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include "resource.h"
LRESULT CALLBACK add(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLGADD), NULL, reinterpret_cast<DLGPROC>(add));
return false;
}
LRESULT CALLBACK add(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
LPTSTR val1 = new char[20], val2 = new char[20], total = new char[20];
HWND hwndVal1, hwndVal2, hwndTotal;
double fVal1 = 0, fVal2 = 0, fTotal = 0;
switch(Msg)
{
case WM_INITDIALOG:
return true;
case WM_COMMAND:
switch (wParam)
{
case IDOK:
hwndVal1 = GetDlgItem(hWndDlg, IDC_EDIT1);
hwndVal2 = GetDlgItem(hWndDlg, IDC_EDIT2);
hwndTotal= GetDlgItem(hWndDlg, IDC_OUT);
GetWindowText(hwndVal1, val1,20);
GetWindowText(hwndVal2, val2,20);
fVal1 = atof(val1);
fVal2 = atof(val2);
fTotal= fVal1 + fVal2;
total = _gcvt(fTotal,12,total);
SetWindowText(hwndTotal, total);
break;
case IDEXIT:
EndDialog(hWndDlg, 0);
break;
case WM_DESTROY:
EndDialog(hWndDlg, 0);
break;
}
}
return false;
}
Athlon XP 1800+
512Mb DDR266 RAM
Leadtek Geforce 6800
Thermaltake 360W PSU
56X CD-ROM
52x24x52 Samsung CD-RW
20 GB Maxtor HDD
80 GB Hitachi HDD
Gigabyte GA-7DX+ mobo