MSDN explains how to do this for managed code: http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.71).aspx