How to record a video using a macro ? And save the video as .avi file.

Hi,

I am trying to create a macro that will use the record video function in Solid works.With the help of online forums I could  write three modules which allows the Solid works part to rotate around the x,y and z axis. I now want to capture the animation by making use of a macro. I think it is possible to make use of the swCommands_e Enumeration by calling the  swCommands_ScreenCaptureAvi_Begin/swCommands_ScreenCaptureAvi_End member functions. Can you please direct me to how I could accomplish this or any alternative?

Thank you in advance

SolidworksApi/macros