1. John Raghanti
  2. PowerBuilder
  3. Friday, 09 August 2019

Hello. We are migrating a client/server desktop application from PB 12.5 to PB 19. Some of our OLEObject functionality appears to have broken, and I'm looking for some help. It's a homegrown DLL wrapper to C#.

Here is a snippet of the code in question:

oleobject inv_ole
inv_ole = CREATE OLEObject
result = inv_ole.ConnectToNewObject("Our.HomeGrown.PBWrapper.DoIt")
if result <> 0 then
     DESTROY inv_ole
     SetNull(inv_ole)
     return
end if

inv_ole.MessageWindowHandle = handle(this)

 

In PB 12.5, everything works as expected. In PB 19, I get the following error:

(Error: 39) Error accessing external object property messagewindowhandle at line 113 in ue_ourevent event of object w_our_window line 113 in ue_ourevent event of w_our_window

 

Any thoughts? Thanks!

John Raghanti Accepted Answer Pending Moderation
0
Votes
Undo

I found a way around the issue. In talking with Appeon, they mentioned ANSI encoding vs. UTF-16LE. That got me looking at the variables on both sides of the equation, C# and PB. While there was no noticeable difference, I did notice that the instantiated inv_ole object looked slightly different between PB 12.5 and PB 2019 at runtime.

On a guess, I decided to strongly type the variable being used to set the handle.

I changed this code:

            inv_ole.MessageWindowHandle = handle(this)

To this:

            Long ll_handle
            ll_handle = handle(this)
            inv_ole.MessageWindowHandle = ll_handle

Everything works as expected now. I'm guessing the the OLE Object couldn't resolve the variable type being used?

 

Comment
There are no comments made yet.
  1. Wednesday, 14 August 2019
  2. PowerBuilder
  3. # 1
Armeen Mazda Accepted Answer Pending Moderation
0
Votes
Undo

Hi Tobias,

No, you do not need to register the C# assemblies. It's very easy to deploy!

There is very good chance about the estimated release date since our engineers have working example already, but please check back around end of September to get status update.

Here is a code example of how to call C# assemblies using our internal test version of PB 2019 R2:

lcsa_assem = create CSharpAssembly
lcsa_object  = create CSharpObject

ll_return  = lcsa_assem.loadwithnetframework("NetAssemTest.dll", false)
mle_1.text += "lcsa_assem.loadwithnetframework:"+ string(ll_return) + "error:"+string(lcsa_assem.errortext)+"~r~n"

ll_return = lcsa_assem.createinstance("assemblynet.CSharpClass",lcso_object)
mle_1.text += "createinstance:"+ string(ll_return) +"~r~n"

li_c = 1
li_c = lcso_object.GetSalary()
mle_1.text += "GetSalary return =10000:"+ string(li_c)+"~r~n"

Regards,
Armeen

Comment
About using the GetAdoConnection object, you can refer to the link below :

https://www.appeon.com/support/documents/appeon_online_help/pb2019/connecting_to_your_database/ch05s05.html
  1. Mark Lee
  2. Tuesday, 13 August 2019
Hi Mark,



thank you very much for your answer.



Will there be webinar in the future, that shows the full functionality?



Regards,

Ferdinand







  1. Ferdinand Fischer
  2. Wednesday, 14 August 2019
Most likely there would be, but at this point we haven't scheduled yet so please stay tuned. If you are not yet subscribed to Appeon newsletter, we suggest you subscribe so you get notified: http://eepurl.com/bGcjSD
  1. Armeen Mazda
  2. Wednesday, 14 August 2019
There are no comments made yet.
  1. Monday, 12 August 2019
  2. PowerBuilder
  3. # 2
Tobias Roth Accepted Answer Pending Moderation
0
Votes
Undo

Hi Armeen, 

I have two questions about the ability to directly call c# assamblies in R2.

Do we need to register the c# assamblies? 

How good are the chances for the estimated release date "early november"?

We would need some more technical information about that feature.

Thanks & Regards Tobi

Comment
There are no comments made yet.
  1. Friday, 9 August 2019
  2. PowerBuilder
  3. # 3
Armeen Mazda Accepted Answer Pending Moderation
0
Votes
Undo

I know this won't help you immediately, but in Revision 2 of PB 2019 we are adding ability to directly call C# assemblies without having to create wrappers/workarounds.  At this time, the best estimate I can give you is that Revision 2 will be released early November.

Comment
There are no comments made yet.
  1. Friday, 9 August 2019
  2. PowerBuilder
  3. # 4
  • Page :
  • 1


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