Ulia 0 Newbie Poster

Hello!I need my program to display data from Edit control. But the main window does`n update when I press OK button on Dialog boxes. Please, help me to find out what`s wrong with it...(please sorry for my English). Thanks in advance for any help.

#include <windows.h>
#include "resource.h"
#include <tchar.h> 
#define PI 3.1415926

double r=0, S=0;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK AboutReaProc(HWND, UINT, WPARAM, LPARAM);
BOOL fRelative;
char szProgName[] = "ProgName";
/////////////////
char lpWord[60];
HWND hdlg;
WORD cchText; 
////////////////
char* buf; char tbuffer[_CVTBUFSIZE], tbuffer2[_CVTBUFSIZE];
int len;
  TCHAR	buffer[64], *pEnd;
      
////////////
int MODE,x,y,z;
HWND hWnd;
HWND g_hToolbar = NULL;


int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPreInst,
				   LPSTR lpszCmdLine,int nCmdShow)
{
	HWND hWnd;
	MSG lpMsg;
	WNDCLASS wcApp;

	if(!hPreInst){
		wcApp.lpszClassName = (LPCSTR)szProgName;
		wcApp.hInstance = hInst;
		wcApp.lpfnWndProc = WndProc;
		wcApp.hCursor = LoadCursor(NULL, IDC_ARROW);
		wcApp.hIcon = NULL;
		wcApp.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
		wcApp.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
		wcApp.style = CS_HREDRAW | CS_VREDRAW;
		wcApp.cbClsExtra = 0;
		wcApp.cbWndExtra = 0;
		if(!RegisterClass(&wcApp))
			return 0;
	}
	hWnd = CreateWindow((LPCSTR)szProgName, (LPCSTR)_T("Data Entery"),
		WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
		CW_USEDEFAULT, CW_USEDEFAULT,
		CW_USEDEFAULT,(HWND)NULL,
		(HMENU)NULL, (HINSTANCE)hInst,(LPSTR)NULL);
	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);

	while(GetMessage(&lpMsg, NULL, 0, 0)){
		TranslateMessage(&lpMsg);
		DispatchMessage(&lpMsg);
	}
	return(lpMsg.wParam);
}



BOOL CALLBACK AboutIntProc(HWND hdlg, UINT messg,
		WPARAM wParam, LPARAM lParam)
{

	switch(messg)
	{
		case WM_INITDIALOG:
			return TRUE;
			break;

		case WM_COMMAND:
			switch (LOWORD(wParam))
		   {
			

			 case IDOK:
				 
		GetDlgItemText(hdlg, IDC_EDIT6, buffer, sizeof(buffer) / sizeof(TCHAR));
		a = _tcstol(buffer, &pEnd, 10);
		GetDlgItemText(hdlg, IDC_EDIT7, buffer, sizeof(buffer) / sizeof(TCHAR));
		b = _tcstol(buffer, &pEnd, 10);
		GetDlgItemText(hdlg, IDC_EDIT8, buffer, sizeof(buffer) / sizeof(TCHAR));
		c = _tcstol(buffer, &pEnd, 10);
                GetDlgItemText(hdlg, IDC_EDIT5, buffer, sizeof(buffer) / sizeof(TCHAR));
		d = _tcstol(buffer, &pEnd, 10);


 			 case IDCANCEL:
             EndDialog(hdlg, 0);

			 default:
				return FALSE;
		     }
	        
	     
		default:
			return FALSE;
			
	  }

	UpdateWindow(hWnd);
	return TRUE;
}


BOOL CALLBACK AboutReaProc(HWND hdlg, UINT messg,
		WPARAM wParam, LPARAM lParam)
{

	switch(messg)
	{
		case WM_INITDIALOG:
			return TRUE;
			break;

		case WM_COMMAND:
			switch (LOWORD(wParam))
		   {
			

			 case IDOK:	
		GetDlgItemText(hdlg, IDC_EDIT2, buffer, sizeof(buffer) / sizeof(TCHAR));
		r = _tcstod(buffer, &pEnd);	
        S = r*r*PI;
				
			 case IDCANCEL:
                 EndDialog(hdlg, 0);

			 default:
				return FALSE;
		     }
	        
	     
		default:
			return FALSE;
			
	  }
InvalidateRect(hdlg, NULL, TRUE);
	UpdateWindow(hWnd);
	return TRUE;
}


LRESULT CALLBACK WndProc(HWND hWnd,UINT messg,
		WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	PAINTSTRUCT ps;
	static HPEN hPen;
	static HWND hInst;
	
	switch(messg){

		case WM_CREATE:
                   break;

		case WM_COMMAND:

			switch(LOWORD(wParam)){

               
					case ID_INPUT_REAL:
					MODE=3;
			g_hToolbar = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG3),
            hWnd, AboutReaProc);
			 if(g_hToolbar != NULL)
        {
            ShowWindow(g_hToolbar, SW_SHOW);
        }
        else
        {
            MessageBox(hWnd, "CreateDialog returned NULL", "Warning!",  
                MB_OK | MB_ICONINFORMATION);
        }
			        break;

					case ID_INPUT_EXIT:
               PostQuitMessage(0);
				
				default:
					break;
           

			}
			break;
		case WM_PAINT:
        ;

			hdc=BeginPaint(hWnd, &ps);
			hPen = CreatePen(PS_SOLID, 1, RGB(255,62,150));
			SelectObject(hdc, hPen);

                
			
            if (MODE==3)
		    {
			 _gcvt(r,5 ,tbuffer2);
			 _gcvt(S,20 ,tbuffer);
			 TextOut(hdc, 5, 5, LPCSTR("For a radius of: "), strlen(LPCSTR("For a radius of: ")));
			 TextOut(hdc, 120, 5, (LPCSTR)tbuffer2, strlen((LPCSTR)tbuffer2));
			 TextOut(hdc, 5, 35, LPCSTR("The circle area is: "), strlen(LPCSTR("The circle area is: ")));
		     TextOut(hdc, 160, 35, (LPCSTR)tbuffer, strlen((LPCSTR)tbuffer));
			 
			 }
           
			EndPaint(hWnd, &ps);
			break;

		case WM_DESTROY:
			DeleteObject(hPen);
			PostQuitMessage(0);
			break;

		default:
			return(DefWindowProc(hWnd, messg, wParam, lParam));
	}
	return 0;
}