Accessing a custom DLL

Thank you Mark. This is probably my problem. I will try it. I’ve been doing the hard things like pointers and stuff for so long that it’s sometimes difficult to see that this new world might be a bit simpler.

1 Like

@Joel_Bailie - just to answer the original question because sometimes just because you can add do it in a customization doesn’t mean it is the right or wrong approach. There are a lot of valid reasons for leaving it a library such as multiple systems using it. I think in this case it does make sense to do this in the customization. Here is how you would have added this into your customization.

  1. Copy the .dll to your Epicor client folder (deployment can handle this for all clients)
  2. Open your Customization and go to Tools - Assembly Reference Manager and add a new custom reference. This will open your client folder.Browse and select your library file.
  3. Add using statement in Script Editor with other using
using ClassLibraryExample;
  1. Add button using toolbox and button click event using wizards
    Create instance and call method
	private void btnExample_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		ExampleClass exam = new ExampleClass();
		string returnString = exam.ExampleMethod();

	}

Hi Dan,

In the very first message Joel mentioned he wanted/needed to be cloud ready. If he means SaaS, then Epicor does not allow custom libraries. If they’re going to Azure/AWS as Single Tenants then this approach will work.

Yep - wasn’t sure what cloud ready means these days and just wanted to give him an example. Back to the original post I had about adding a wrapper if there is a valid reason for having it separate :slight_smile: Also - isn’t he most likely adding a custom reference either way since I don’t think Windows.Devices.HumanInterfaceDevice is available.

I am not sure at this time but I am fairly certain we are going the SaaS route. Didn’t know that this would prohibit custom libraries. Glad I know now and will continue to develop the customization approach.

Yes, he’ll have to add a reference but I’m assuming the HDI library is already on the clients in the standard .Net libraries. What SaaS users can’t do is step 1, put a custom library in the deployment folder since all SaaS users share the same deployment folder in the CDN.

Still needs to go in the Epicor folder instead of System32

True. Another option that @Joel_Bailie might look at is making the scale connection a standalone Windows service and then have the customization access the service. This approach would work when Epicor gets to a full web client as well. :thinking:

I think we went full circle back to my wrapper reference to start with :slight_smile:

1 Like

I found the Windows.Devices.HumanInterfaceDevice.dll in C:\Windows\SysWOW64 but Epicor will not allow me to add it as a reference. Is there some trick for this? I tried adding it, when in customization, via Tools\Assembly Refence Manager.

You might try copying it into the Epicor client folder. I’m not sure what other dependencies it might have though…

I finally got this to work in a new customization associated with UD26. I couldn’t get it to work on a remote computer but I can on my computer that I am developing on. I have another question. I can’t access this customization unless I am in developer mode. Is there a setting I need to change so I can get to my customization regardless or whether I am in developer mode or not?

You need to create a menu item and add the customization to the menu item.

1 Like

What Dan said above, plus there is a “feature” in certain E10 versions that means it will only show if it is ticked as “All Companies” when saving the customisation.

You’ll see from my code example that my COM Port is COM11 - it isn’t a local port. It’s actually a virtual port, created by a Lantronix Serial-Ethernet Adapter:

There is a free piece of software on them website called CPR (COM Port Redirector). It receives data on a virtual local port on a PC, and then directs it over the network to the device shown above which connects to the physical serial device. It’s worked great since I put it in, and means that a serial device can be accessed anywhere in the world. I believe you could have multiple PCs with the software installed, all accessing the same device. It opens a connection, makes the request, then closes it out again.

My customization is under UD26 Extended UD Table Maintenance. Is there anything I need to do prior to creating a menu item? I tried creating a menu item and in the customization dropdown there was nothing and I wasn’t sure where to find my UD26 script.

Typically - you create the menu item and you see it in the drop-down. Some versions have issues but can you post a screenshot of your menu item and also of the customization in customization maintenance? Like below.

Guys, Its been a few days and I’ve been working on various things but thought I would thank you guys for all of your sound expertise, guidance and wisdom. I finally have this part of my project complete and its working great. It is now on to the next stage of the project and a whole new learning experience I’m sure.