wndproc.cpp


#include <windows.h>
#include "resource.h"

// Prototype
BOOL OnCmnd(HWND, UINT, WPARAM, LPARAM);
BOOL OnPaint(HWND, UINT, WPARAM, LPARAM);

LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
  
  switch( uMsg )
  {
  case WM_COMMAND:
    if(!OnCmnd(hwnd, uMsg, wParam, lParam))
      return( DefWindowProc( hwnd, uMsg, wParam, lParam) );
    break;
  case WM_PAINT:
    if(!OnPaint(hwnd, uMsg, wParam, lParam))
      return( DefWindowProc( hwnd, uMsg, wParam, lParam) );
    break;
  case WM_DESTROY:
    PostQuitMessage( 0 );
    break;
  default:
    return( DefWindowProc( hwnd, uMsg, wParam, lParam ) );
  }
  return 0;
}