W32dry: don't repeat yourself in Win32!

This is some silly software I wrote when playing around with writing Win32 programs on Linux using Mingw32 and WINE. I factored out my ignorant approximation of the stuff in common among most Win32 API programs and called it "w32dry". Like everything else posted to kragen-hacks without a notice to the contrary, this code is in the public domain.

You probably ought to be able to compile this stuff on Win32 with Mingw as well, but I haven't tried.


kragen@thrifty:~/devel/w32dry$ ls -l
total 152
-rw-r--r--  1 kragen kragen 27377 2008-08-02 16:08 w32dry.tar.gz

This is a tarball containing all of these files, which is convenient if you want to compile and modify this stuff instead of just looking at it.


-rw-r--r--  1 kragen kragen   746 2008-06-09 00:24 dryhi.c
-rwxr-xr-x  1 kragen kragen  7168 2008-08-02 15:02 dryhi.exe
-rw-r--r--  1 kragen kragen  2118 2008-08-02 16:07 dryhi.png

dryhi is a w32dry "hello world" program; it pops up an empty window with its own WndProc that behaves more or less as you'd expect a window to behave.


-rw-r--r--  1 kragen kragen  1098 2008-06-10 21:04 w32dry.h
-rw-r--r--  1 kragen kragen  2147 2008-06-10 23:00 w32dry.c

These two files embody the "common" Win32 stuff from a "hello, world" program that I could easily factor out. dryhi depends on these, as do all the other programs; that's why dryhi.c is 29 lines instead of 80.


-rw-r--r--  1 kragen kragen  1293 2008-06-09 01:52 follow.c
-rwxr-xr-x  1 kragen kragen  7680 2008-08-02 15:02 follow.exe
-rw-r--r--  1 kragen kragen  4010 2008-08-02 16:03 follow.png

follow is the next step after dryhi: a nearly minimal w32dry program that takes input, drawing some text following the mouse.


-rw-r--r--  1 kragen kragen  2593 2008-06-10 23:00 circles.c
-rwxr-xr-x  1 kragen kragen  8704 2008-08-02 15:02 circles.exe
-rw-r--r--  1 kragen kragen  8059 2008-08-02 15:56 circles.png

circles draws a zoneplate pattern in colors, following the mouse. This is the only program here that is actually cool, as opposed to just being a "hello, world" example.


-rw-r--r--  1 kragen kragen  5250 2008-06-10 22:56 onefile.c
-rwxr-xr-x  1 kragen kragen  8192 2008-08-02 15:02 onefile.exe

onefile is a single-file version of circles that includes w32dry; I wrote it so as to be able to post it to kragen-hacks.


drwxr-xr-x 56 kragen kragen 65536 2008-07-22 00:41 ..
drwxr-xr-x  2 kragen kragen  4096 2008-08-02 15:03 .
-rw-r--r--  1 kragen kragen  1156 2008-08-02 16:06 Makefile

The Makefile makes it easy to compile all this stuff, and embodies my hard-won knowledge of how to work around WINE and Mingw stupidity. (Don't get me wrong; WINE and Mingw are fantastic. Just stupid sometimes.)