Cannot Create ActiveX Component [resolved]
Hi, im new to these forums :wave: This one shouldn't be too difficult. In my VB.NET application i'm using COM objects from the Windows Media Encoder SDK. I've created a .msi file from the setup wizard and installed it on a different machine. When the app creates an instance of the encoder object I get this error message
Quote:
An unhandled exception has occured in a component in your application. Click continue and application will ignore this error and attempt to cotinue.
Cannot Create ActiveX Component
Followed by these Details
Quote:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Exception: Cannot create ActiveX component.
at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName)
at WindowsApplication16.Form1.Button1_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
WindowsApplication16
Assembly Version: 1.0.1927.26636
Win32 Version: 1.0.1927.26636
CodeBase: file:///C:/Program%20Files/XXX/EncRunTest/WindowsApplication16.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
Interop.WMEncAgtLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/XXX/EncRunTest/Interop.WMEncAgtLib.DLL
----------------------------------------
Interop.WMEncoderLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/XXX/EncRunTest/Interop.WMEncoderLib.DLL
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
These are the files in my install directory
Quote:
Interop.WMEncAgtLib.dll
Interop.WMEncoderLib.dll
Interop.WMPREVIEWLib.dll
WindowsApplication3.exe
wmenc.exe
WMEncAgt.exe
wmprevu.dll
I did a search on these boards and came to the conclusion that my dll's need to be registered in order to use them in this fashion. Well after using regsvr32 the only dll that would register was "wmprevu.dll" it appears that the others are non-activex based. Unfortunatley I am not sure if I am using the right approach to this. If anything I hope that I could get some light shed on what else needs to be done to get this working.
Re: Cannot Create ActiveX Component
You do, in fact, have to register your DLL's.
What object are you trying to create in the Click() event of Button1? Did you register the DLL that contains this object?
I'm not sure what you have to include to redistribute the Windows Media Encoder SDK, but it sounds like you're missing some required DLL's. Check the documentation in the SDK for information on redistributing code that uses the SDK. If you just want to get this to work on the second machine, you could try installing the SDK on that machine.
Hope this helps.