Here is the code promised yesterday. Warning, David Humphrey told me that Carbon code from nsMessengerOSXIntegration.cpp is outdated (absolutely), ugly and possibly leaking. In the meantime, it's useful to have it if like me you really need a badge on your dock icon. Last point, I have not installed Snow Leopard yet so it's untested on OS X 10.6...

Just look at the IDL to understand how it works, it's really simple.