Take a look at the Realworld Cursor Editor that you find here .
Edit: As OP pointed out, OP was looking for a way to create an animated cursor programmatically using Win32API. AFAIK this cannot be done, or it is a long way to do it, the LoadCursor ' function can load the cursor from an embedded resource or a file on a disk with the extension .ani, therefore my answer is in support of using the Realworld Cursor Editor, which can create a .ani file containing animated cursors, another way to do this is to use Control Panel> Mouse, click on the Pointers tab in the dialog itself to set it as system-wide parameters. Here is an example of how the animated cursor loads here .
Hope this helps, Regards, Tom.