How to create an ActiveX control in C#?

If you read the actual article using the Prisoner.PrisonerControl control a sub key named Control is created inside the key with your control GUID.

On my machine with the guid {9DEA5F06-E324-31A7-837B-D0F3BDE91423} creating the key

HKEY_CLASSES_ROOT\CLSID\{9DEA5F06-E324-31A7-837B-D0F3BDE91423}\Control

Make the control appears in tstcon32. And with or without it the ActiveX is usable for javascript

var x = new ActiveXControl("Prisoner.PrisonerControl");

Actually i had to fight windows on both the javascript execution and registry path to test it on my system because it's an x64 machine but that's another story.


You have created a COM server but not an ActiveX control, which is a far more intricate COM object, the kind that you can exercise with tstcon32.exe.

It must implement a bunch of interfaces, key ones are IOleObject and IOleWindow. The kind of interfaces that allows it to do the required negotiations with an ActiveX host and create a visible window. The Winforms Control class is your best bet to create one.