Page 1 of 2

Cannot Create ActiveX component

PostPosted: Fri Nov 29, 2019 1:32 pm
by Riyaz
Hi There

Am trying to call our custom dll through the plugin in v7.2.1 but getting the attached error, pls see the code snippet below that am using, FYI, have kept the custom dll in the Jiwa Financials folder and its referenced in the plugin.

Try

PickSlip = CreateObject("AtronicsEDIClassLibrary.PickSlip")

With PickSlip
.JiwaConnectionString = CStr(salesOrderForm.SalesOrder.Manager.Database.ConnectionString)
.DatabaseName = salesOrderForm.SalesOrder.Manager.Database.DatabaseName
.UserName = salesOrderForm.SalesOrder.Manager.Database.JiwaLoginUserName

.Initialize
.SendPS

If .Message <> "" Then
MsgBox("Error creating warehouse pick slip: " & .Message)
End If

End With
PickSlip = Nothing
salesOrderForm.Refresh ()

Catch ex  As Exception 
MsgBox(ex.Message+ex.StackTrace )
End Try

Re: Cannot Create ActiveX component  Topic is solved

PostPosted: Fri Nov 29, 2019 5:40 pm
by SBarnes
That error would indicate that AtronicsEDIClassLibrary.PickSlip can not be resolved to the underlying CLSID in the registry which would either indicate the dll is not registered on the machine or you don't have execute permission, more likely the first.

If it's you own DLL and code I would suggest you either migrate the code to inside the plugin or migrate it to a .net class library that can then be added as an embedded reference and will automatically deploy with the plugin and do away with COM completely unless there is a specific reason it needs to remain COM based.

Re: Cannot Create ActiveX component

PostPosted: Fri Nov 29, 2019 6:20 pm
by Mike.Sheen
I concur with Stuart.

If you absolutely must use this COM object, I'd first start with a small, one line .NET console application containing the line of failure:

Code: Select all
PickSlip = CreateObject("AtronicsEDIClassLibrary.PickSlip")


Once you get that working it should work within a Jiwa plugin.

To get that small console application working - as Stuart mentioned - that component needs to be registered - if it is not already. You register COM dll's by using the Microsoft command line tool, regsvr32. Just Google that to find articles / guidance on how to use that.

Also all COM dependencies that dll uses will also have to be registered, or you will arrive at the same error.

Re: Cannot Create ActiveX component

PostPosted: Sat Nov 30, 2019 8:13 am
by SBarnes
You may find this tool helpful if there are dependencies http://www.dependencywalker.com/

Re: Cannot Create ActiveX component

PostPosted: Wed Dec 04, 2019 10:15 pm
by Riyaz
Thanks both

The custom app along with has been installed on the server, registered with the regasm and also referred the dll in the plugin, but still get that activex error.

Any further recommendations pls

Re: Cannot Create ActiveX component

PostPosted: Wed Dec 04, 2019 10:33 pm
by SBarnes
When you say you used regasm did you use the 64 bit or 32 bit version see https://stackoverflow.com/questions/372 ... r-regsvr32

Also if you have the source code I would go back to my original suggestions of porting the code, long term this probably the best option.

My only other suggestion is if this is a COM DLL that was created in visual basic 6 you may need to install the the vb6 runtime

You may also need to ensure that the user that this is executing under has permissions to where the DLL is

Re: Cannot Create ActiveX component

PostPosted: Wed Dec 04, 2019 10:55 pm
by Mike.Sheen
Riyaz wrote:The custom app along with has been installed on the server, registered with the regasm


I don't think you don't want Regasm. I thought Regasm was to make .NET assembly able to be called from COM. This is the opposite of what you want.

From the docs on Regasm:
The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently


You can call a COM dll from .NET using the CreateObject method if it is registered - and to register a COM dll you need to use Regsvr32.

If you provide a sample .NET project trying to call the COM dll along with the COM dll itself, I might have a chance in working out what you need to do. If you don't want to post it here, you can create a service issue on our helpdesk and provide the necessary resources and I can look at it.

Re: Cannot Create ActiveX component

PostPosted: Fri Dec 06, 2019 7:03 am
by SBarnes
I would still port the code in the long run this would make life easier

Re: Cannot Create ActiveX component

PostPosted: Fri Dec 06, 2019 8:19 am
by Scott.Pearce
SBarnes wrote:I would still port the code in the long run this would make life easier


Absolutely agree with this.

Re: Cannot Create ActiveX component

PostPosted: Fri Dec 06, 2019 6:13 pm
by Mike.Sheen
SBarnes wrote:I would still port the code in the long run this would make life easier


Even if you no longer have the source code to port, it would be a huge benefit to re-create the logic in .NET - either as a class library or just as a plugin. Doing so reduces your technical debt - once you accrue enough of that debt, it'll find a way to make you pay that debt at the most inconvenient time - so better to be proactive and do it sooner.