1. Emilio García Andrés
  2. PowerBuilder
  3. Thursday, 25 March 2021 13:16 PM UTC

Hi all.

Has anyone ever worked with a .dll made in VB, which one of its functions returns an array of objects (arraylist). In PowerBuilder I can load the result of the function in an ANY type variable, but I am unable to load it into an ANY ARRAY type variable, for example ANY LA_MYARRAY [].

Thanks in advanced.

Emilio García Andrés Accepted Answer Pending Moderation
  1. Saturday, 27 March 2021 07:27 AM UTC
  2. PowerBuilder
  3. # 1

Hi all.

Regarding the use of the PB2019R2 .NET DLL Importer utility, for the system that I am developing on DigitalPersona fingerprint reader, I show you the error it gives me when trying to import the DLL. The return type is a Arraylist, in this case it is an array of objects, each object is a fingerprint reader connected to my system. As this type of data is not supported in PB (as shown in the image), I will have to create a DLL in VB NET, which will only return one object (the first fingerprint reader it finds). I have already done that, tested and it works fine. The only problem is that in my deployment of the PB solution, I also have to include this DLL made with another system. For me the ideal scenario is that PB can do everything and not have to resort to external DLLs. I trust that in successive versions of PB this problem will be solved and the .NET libraries can be imported 100%.

Best regards.

Comment
  1. Armeen Mazda @Appeon
  2. Saturday, 27 March 2021 13:56 PM UTC
You will need to creat a .NET wrapper that maps the unsupported return type to a format that is supported. The documentation explains what is not supported: https://docs.appeon.com/pb2019r2/application_techniques/ch20s01.html

  1. Helpful
  1. Emilio García Andrés
  2. Monday, 29 March 2021 06:15 AM UTC
Hi Armeen.



Yes effectively. It is the line that I am working on already. I'm going to create a .NET wrapper with the basics to be able to solve what PB doesn't do. Thanks a lot.
  1. Helpful
There are no comments made yet.
Emilio García Andrés Accepted Answer Pending Moderation
  1. Friday, 26 March 2021 06:14 AM UTC
  2. PowerBuilder
  3. # 2

Thanks to both for the answers.

The origin of the problem is that I am trying to connect a FingerPrint Scanner (Digitalpersona U4500), with the SDK (2.2.3), and oddly enough, the SDK documentation is very poor, and in the community there are no use cases to use PB vs this fingerprint. I'll investigate what Chris tells me. My plan B is to come back to 1998 and create a VB6 COM object (.dll or .ocx) in which I encapsulate the tasks that I need to do on the Fingerprint scanner (Enrollment and Verification), and use that OLE object in my PB application.

Best regards.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 26 March 2021 00:20 AM UTC
  2. PowerBuilder
  3. # 3

Greetings, Emilio - 

I'm 99% sure your current approach is not going to work. While the PB Any data type is remarkably versatile within the PB realm, it is intended for use only with PB standard data types and PB objects. PB has no knowledge of VB.NET objects, so the assignment of any VB.NET object to the PB Any data type is not going to be successful. Furthermore, an ArrayList object is a collection (class) of objects, not an array.

The only possible way I can see you being to access whatever objects are in the ArrayList object is via PB OLEObject objects, and I have never used these to access VB.NET objects and cannot advise you on how to proceed. The Object Model for Visual Basic for Applications (VBA) is pretty well documented by Microsoft and therefore can and has been used by PB applications to interact with Word, Excel and Outlook, for example, and you can find code samples on the web.

My guess is that if it is possible, that interfacing with VB.NET is going to be similar to VBA, but not identical. When you connect OLE in PB to Outlook, for example, you use the ConnectToNewObject('Outlook.Application') PowerScript function to establish the connection. I am not familiar with the name of the OLE Server for VB.NET (what you would specify in place of 'Outlook.Application'), nor have I been able to locate any documentation on the VB.NET Object Model in the few minutes I had available to look.

Hopefully, others in the Community that have done this can help. The tips that Chris has provided may also prove to be a viable solution for you.

Good luck!

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 25 March 2021 20:13 PM UTC
  2. PowerBuilder
  3. # 4

Hi Emilio;

  You can access a .NET Assembly created by any .NET language (ie: C#, VB.Net, etc) using the new DotNetAssembly and DotNetObject objects found in PB 2019 R2 and higher. A new tool called the ".NET DLL Importer" is provided to help developers write scripts to correctly call functions in the .NET class.

FYI: http://docs.appeon.com/pb2019r2/whats_new/ch01s03.html

  Also, this discussion thread might be useful ...

http://community.appeon.com/index.php/qna/q-a/how-to-use-net-assemblies-in-pb-classic

  Note in the above thread that VB.Net should work. However, PB's DotNet direct interface is only for Non-Visual code and/or classes. Visual .NET Assemblies / Classes from any .NET language are not yet supported by PB2019Rx.

Regards ... Chris

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.