I am not able to create a functioning ActiveX control in C#; I have tried following tutorials to do so without success.
I create a sample Class Library project which includes this code:
namespace AACWCSurvey
{
[ProgId("Prisoner.PrisonerControl")]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Class1
{
public Class1()
{
MessageBox.Show("FIRETRUCK!!!");
}
}
}
I then did the following steps:
regasm MyDll.dll /tlb /codebase
Can't see Prisoner.PrisonerControl
in tstcon32 =(
My OS is WinXP x86.
UPD: it works from VBScript:
Dim objJava
Set objJava = WScript.CreateObject("Prisoner.PrisonerControl")
but it is not visible in tstcon32.
To create an MFC ActiveX Control using the MFC ActiveX Control Wizard. Follow the instructions in the help topic Creating an MFC Application but choose MFC ActiveX Control from the list of available templates. Define your application settings, control names, and control settings using the MFC ActiveX Control Wizard.
ActiveX controls are small program building blocks that can be used to create distributed applications that work over the Internet through web browsers. Examples include customized applications for gathering data, viewing certain kinds of files, and displaying animation.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With