/*      VERSION 0033
  init.c
  initialization for DC II

  WINDOWS 2.0 mods                                                    0028
*/

#include  <stdio.h>
#include  <windows.h>

HANDLE    hInst;
HWND      hMain;
long far PASCAL   WndProc();

/* Init
    called when loaded for the first time
*/
static
BOOL Init( hInstance )
  HANDLE  hInstance;
{
  WNDCLASS   pClass;

  pClass.hCursor        = LoadCursor( NULL, IDC_ARROW );
  pClass.hIcon          = LoadIcon(hInstance,MAKEINTRESOURCE(1));
  pClass.lpszMenuName   = (LPSTR)"dc";
  pClass.lpszClassName  = (LPSTR)"dc";
  pClass.hbrBackground  = (HBRUSH)NULL; /* paint our own window */
  pClass.hInstance      = hInstance;
  pClass.style          = CS_HREDRAW | CS_VREDRAW;
  pClass.lpfnWndProc    = WndProc;

  if (!RegisterClass( (LPWNDCLASS)&pClass ) )
    /* Initialization failed.
     * Windows will automatically deallocate all allocated memory.
     */
    return FALSE;
  return TRUE;        /* Initialization succeeded */
} /* Init */

/* Initialize
    main init procedure
    sets up all instance data
*/
Initialize(hInstance,hPrevInstance,cmdShow)
  HANDLE  hInstance,hPrevInstance;
  int     cmdShow;
{
  HWND  hWnd;
  HMENU hMenu;

  if (!hPrevInstance) {
    /* Call init proc if first instance */
    if (!Init( hInstance ))  return FALSE;
  }else{
    /* Copy data from previous instance */
  }
  hWnd = CreateWindow((LPSTR)"dc",
                      (LPSTR)"ALculator II",
                      WS_OVERLAPPEDWINDOW,
                      CW_USEDEFAULT, CW_USEDEFAULT,
                      200, 100,
                      NULL,       /* no parent */
                      NULL,       /* use class menu */
                      hInstance,  /* handle to window instance */
                      NULL        /* no params to pass on */
                      );

  /* Save instance handle for DialogBox */
  hInst = hInstance;
  hMain = hWnd;
  /* Make window visible according to the way the app is activated */
  ShowWindow( hWnd, cmdShow );
  UpdateWindow( hWnd );
  return TRUE;
} /* Initialize */

