// to keep simple Win32 applications a little more "DRY"

typedef struct {
  PWNDCLASSEX class;
  HWND hWnd;
  char *title;
  int style;
  int x, y;
} window_instance;

// call this to initialize a WNDCLASSEX and a window_instance.
// doesn't register the window class.  do that yourself.
void init_window_classex(PWNDCLASSEX class,    // pointer to uninitialized class
                         window_instance *win, // pointer to uninitialized inst
                         HINSTANCE hInstance,  // of the application
                         WNDPROC WndProc,
                         LPCSTR name);         // of the window class

// call this to actually instantiate a window handle
// returns 0 on failure
int create_window(window_instance *win, int width, int height);
// call this to pump messages through to your windows
// returns an exit code for the app (normally 0)
int message_loop();

// for things that you want to MessageBox about and exit if they fail
#define check(foo) pcheck(foo, int)
#define pcheck(foo, type) (type)_check(#foo, (int)foo)
int _check(char *contents, int result);
