05-05-2022 02:48 PM
I'm converting from VbScript in OnBase 18 to a potential upgrade to Unity under EP3 or EP5. In a number of VbScripts, i rely on a very custom DLL (written in VB.Net) that has a number of entry points. Each entry point displays a custom data entry screen which also displays data from numerous databases outside of OnBase.
Each call to the DLL looks similar to:
Set objghijklDLL = CreateObject("abcdef.ghijkl")
iDLLReturn = objghijklDLL.LoadForm(lngDocHandle, kwcode1, kwcode2, kwcode3, DLL_DSN)
I've searched both the SDK and on Community, and I haven't found any comparable calls or work arounds for this.
Any suggestions and/or advise would be appreciated.
05-06-2022 07:26 AM
maybe something like this might work?
(shamelessly stolen from: https://stackoverflow.com/questions/11886845/dynamically-calling-a-dll-and-method-with-arguments )
public void callDLL(string dllName, string typeName, string methodName, string arguments) { string[] argumentArray = arguments.Split(',').trim(); Assembly assembly = Assembly.LoadFrom(dllName); System.Type type = assembly.GetType(typeName); Object o = Activator.CreateInstance(type); MethodInfo method = type.GetMethod(methodName); ParameterInfo[] parameters = method.GetParameters(); object[] methodParameters = new object[parameters.GetLength(0)]; for (int i = 0; i < parameters.Length; i++) { var converter = TypeDescriptor.GetConverter(parameters.ParameterType()); methodParameters = converter.ConvertFrom(argumentArray); } method.Invoke(o, methodParameters); }dynamic iDllReturn = callDLL("abcdef", "ghijkl", "LoadForm", "lngDocHandle, kwcode1, kwcode2, kwcode3, DLL_DSN");
05-06-2022 10:36 AM
Well, i dug deeper into the SDK and determined that modifying my DLL slightly and adding it as an Assembly, then creating a new IClientWorkflowScript, allowed it to call the class in the dll and execute it properly.
Added reference to assembly to unity script
then the basic code(VB.NET):
DIM abc as NEW avcdef,fhijkl
abc.loadform(dochandle,kwcode1,kwcode2,kwcode3,DLL_DSN)
Very sparse at the moment, but functionally it calls the DLL...Now, this will only work in the Unity Client...the Web Client would require something more ambitious and beyond the scope of what i need to do.
05-06-2022 07:26 AM
maybe something like this might work?
(shamelessly stolen from: https://stackoverflow.com/questions/11886845/dynamically-calling-a-dll-and-method-with-arguments )
public void callDLL(string dllName, string typeName, string methodName, string arguments) { string[] argumentArray = arguments.Split(',').trim(); Assembly assembly = Assembly.LoadFrom(dllName); System.Type type = assembly.GetType(typeName); Object o = Activator.CreateInstance(type); MethodInfo method = type.GetMethod(methodName); ParameterInfo[] parameters = method.GetParameters(); object[] methodParameters = new object[parameters.GetLength(0)]; for (int i = 0; i < parameters.Length; i++) { var converter = TypeDescriptor.GetConverter(parameters.ParameterType()); methodParameters = converter.ConvertFrom(argumentArray); } method.Invoke(o, methodParameters); }dynamic iDllReturn = callDLL("abcdef", "ghijkl", "LoadForm", "lngDocHandle, kwcode1, kwcode2, kwcode3, DLL_DSN");
05-06-2022 10:44 AM
Thank you
05-06-2022 10:36 AM
Well, i dug deeper into the SDK and determined that modifying my DLL slightly and adding it as an Assembly, then creating a new IClientWorkflowScript, allowed it to call the class in the dll and execute it properly.
Added reference to assembly to unity script
then the basic code(VB.NET):
DIM abc as NEW avcdef,fhijkl
abc.loadform(dochandle,kwcode1,kwcode2,kwcode3,DLL_DSN)
Very sparse at the moment, but functionally it calls the DLL...Now, this will only work in the Unity Client...the Web Client would require something more ambitious and beyond the scope of what i need to do.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.