.NET interop in PowerBuilder

匆匆过客 提交于 2019-12-05 15:16:30

I am sure there is a more eligent way to do this, but using COM might be the easiest.

Some people would say that COM is never the right answer, but I say use the right tool for the right job.

I used the idea from here to create my C# control and it worked with it being called from PB and Qt.

Exposing Windows Form as ActiveX control

You may also want to look at P/Invoke

PowerBuilder (version 6, 7 and 8.0) understand properly only BINARY contracts if you would like to connect objects written in different technologies. In reality it means COM objects with IDispatch interface (so called OleAutomation). It's the same kind of the objects that can be used by interpreted languages like VB6 or jscript (with wscript).

You don't have to deal with ConnectionPoints to have asynchronous communication between objects. Use your own regular interfaces.

Don't use Watcom C++ compiler to build any "proxy objects" - it was very weak compiler a few years ago. I was trying to compile and build some solution and it showed many internal errors during compilation. MS C++ compiler did the compilation without any problems.

Remember that your objects should be apartment compatible. PB uses only STA (Single Threaded Apartment). Please check it - maybe something has changed recently.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!