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!
Will we be able to handle c# events using this method?
The C# Class Importer can import the names and data types of the C# classes, functions, properties and parameters from the C# assembly to the application PBL. It creates the CSharpObject object as an NVO for each C# class and then imports the C# functions to the NVO. After that you can write scripts to call the NVO and functions directly to execute the corresponding C# code. It can also create the CSharpAssembly object for each CSharpObject object and add try-catch and handle the errors, which can greatly simplify the scripts that you might need to write.
So, in other words, importing C# dll's doesn't automatically map your C# events to PowerScript events. You can call the imported functions as needed though.
I hope this helps answer your question.
Regards,