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

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 
{
  switch(msg) {
  case WM_DESTROY:
    PostQuitMessage(0);
    break;
  default:
    return DefWindowProc(hWnd, msg, wParam, lParam);
  }
  return 0;
}

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpCmdLine,
                     int nCmdShow)
{
  WNDCLASSEX windowClass;
  window_instance win;
  init_window_classex(&windowClass, &win, hInstance, WndProc, "AClass");
  if (!RegisterClassEx(&windowClass)) return 1;
  win.title = "hello, world";
  if (!create_window(&win, 400, 400)) return 1;
  ShowWindow(win.hWnd, nCmdShow);
  return message_loop();
}
