From C++, the two traditional approaches are to use ATL or MFC. Both will provide equivalent frameworks for creating OCX / COM components that can be embedded into other applications.
There are lots of examples on CP. Here's one.
Hex Editor (OCX Control)[
^]
... and another.
EAN-13 BarCode ActiveX Control Drawer[
^]
In Visual Studio you can use the wizard to create an empty control from a template. From there you can edit away to add functionality.
File -> New Project -> Visual C++ -> MFC -> MFC ActiveX Control
File -> New Project -> Visual C++ -> ATL -> ATL Project