EDIT: BTW Alimonster, where did you get the rest of my code? :shock:

Well, I've got it working now.

In my actual code I was doing:
[pascal]
constructor TThing.Create;
begin
Self.RegisterMessageHandler(WM_PAINT, PaintProc); // this doesn't work
end;[/pascal]
Which gives a "Not enough actual parameters" error.

But doing this works:
[pascal]
constructor TThing.Create;
begin
RegisterMessageHandler(WM_PAINT, PaintProc); // this does work
end;[/pascal]

I would have thought these would be exactly the same. :?