DMUS_PMSG::dwType is the type of the message, but we are comparing it to curve types. We should be using DMUS_CURVE_PMSG::bType instead.
* * *
(I tried to write some test cases for this. I created a IDirectMusicPort implementation that checks the generated midi commands, but instead I cannot get Windows to generate any midi commands for CCCURVEs. )