The topic is covered quite completely here:
ActiveX Controls: Overview
http://msdn.microsoft.com/en-us/library/aa268948(VS.60).aspx
and an excellent step-by-step tutorial here, including source code:
ActiveX Control Tutorial
http://www.codeguru.com/cpp/com-tech/activex/controls/article.php/c5517