How to use a third-party dll in a SideBar with Add-in-express

Add-in Express™ Support Service
That's what is more important than anything else

How to use a third-party dll in a SideBar with Add-in-express
How to use a third-party dll in a SideBar with Add-in-express  
David Laning




Posts: 4
Joined: 2010-05-31
I have a third party dll (and ocx) that I would like to use with my SideBar in Add-in-Express. The project is in C#. I could not find an example in the forum on how to do this. A simple dll example to get me going would be highly appreciated. In addition, If there is an ocx example that would be fantastic. Thank You.???DBL
Posted 31 May, 2010 23:14:53 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi David,

As far as I understand you have a third-party ActiveX Controls library and you need to place an ActiveX control onto your IEBar (that is inherited from the System.Windows.Forms.UserControl class). You can do this in a usual way by adding a reference to your project, adding the ActiveX control to the Visual Studio toolbox and then dropping the added control onto your IEBar. Please see this http://msdn.microsoft.com/en-us/library/ms973200.aspx, it will help you with adding a reference and modifying the toolbox.

If you face any difficulties, please let me know, I will try to help further.
Posted 01 Jun, 2010 05:31:27 Top
David Laning




Posts: 4
Joined: 2010-05-31
Dmitry:

I am getting thrown a "LoaderLock was detected" error.
"Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initilzation function since doing so can cause the application to hang."

Here is the experimental setup:
1) I added the third party .ocx file (ActiveX control) to the Visual Studio 2008 toolbox.
2) I created a Winform test project #1.
3) I created an Add-in-Express IEBar test project #2

Note: This particular third party ActiveX control does *not* have a graphical component to it.

4) I dropped the control onto the Winform in test project #1 and programmed a small C# app that used the control object's methods and changed it's properties.
5) I dropped the control onto the Add-in-Express IEBar in test project #2 and use the same a small C# app (as in test project #1) that used the control object's methods and changed it's properties.

6) Clean/Rebuild/Debug test project #1: the ActiveX control works. :-)
7) Clean/Rebuild/Debug test project #2: run time error (LoaderLock) thrown when the IEbar is opened up :-(

I investigated which line(s) of code were causing the error and I narrowed it down to the assignment statement:
this.axThirdPartyOcx1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axThirdPartyOcx1.OcxState")));

in the middle of the InitalizeComponent code for Add-In-Express.

Any ideas on how to workaround this problem?

Thank You

DBL
Posted 03 Jun, 2010 23:13:46 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi David.

You can disable the Loader Lock exception in the Exceptions dialog of Visual Studio (Debug->Exceptions->Managed Debuggingc Assistants). It doesn't affect the application.
Posted 04 Jun, 2010 07:46:41 Top