[Haskell-cafe] Win32 API

Andrew Coppin andrewcoppin at btinternet.com
Sat Sep 19 03:52:14 EDT 2009


Hi guys.

Last time I looked at the Win32 bindings, it covered a few basic file 
I/O things (e.g., special access modes, file permissions, etc.), 
registry editing, and that was about it. Yesterday I took another look, 
and was pleasently surprised to find that GDI is now covered. Suffice it 
to say, yesterday I wrote my very first ever program using the Win32 API 
directly. (Who'd have thought Haskell would be the place to do that?)

This was complicated by a small glitch: Graphics.Win32.Window exposes 
SendMessage() but does not expose PostMessage(). Kind of an important 
difference there. Fortunately, it's not actually especially hard to fix 
this deficiency. (Basically few the source code for the module, copy and 
paste the line for SendMessage(), and edit it to say PostMessage(). The 
type signature just happens to be identical.) Is there a reason why this 
is missing to start with? What other functions are missing? (I didn't 
see PostQuitMessage() anywhere...)

Still, 85 lines of code to make a working, native-looking Windows 
program isn't too shabby, really... (Not that any sane person writes 
nontrivial programs directly like this of course.)



More information about the Haskell-Cafe mailing list