Nice. I remember I did something like this in C++ for Windows 3.11 a long time ago.

I think it should raise some exceptions (and define its own Exception class) instead of just "exit". I hope I can remember this post when I start the Allegro.pas 4.5 version because I'll need it for sure.