You can take a look here: http://msdn2.microsoft.com/en-us/library/k39d6s23.aspx
But the best one might be this: http://www.macoratti.net/08/08/c_pdgv1.htm
I think you can get the idea from the code, since the comments are in portuguese (you can try google translate).