we try using PBNI to connect and wrap Event from SAP B1 and handling them in PB.
Someone can give me hints to pass the Application object created and connected in PBNI (C++) to my PB application
I try using setobject but the application is not a pbobject but a IApplicationPtr
Someone can suggest a solution?
I'm not sure why you are trying to pass the application object back to PB.
I made a passing reference to using PBNI to expose OLE Automation events in this PBDJ article. There is a sample of using that technique with PowerBuilder and Microsoft Work in the old Sybase CodeXchange area (look for pbnioleobject), although it's pretty much written for an older version of Word. Given that the PBDJ article was written in 2006 and the sample was uploaded to CodeXchange in 2003, it's most likely that I did it for Office 2003 at the latest.
If you look at that sample, what you'll notice is that I've created a descendant of oleobject in pbni called n_cpp_oleobject. That descendant has events on it that aren't on the ancestor object. What the extension does is creates and eventsink to capture the events happening on the ole application and then relays them up to the n_cpp_oleobject object.
So, what you then do is use n_cpp_oleobject the same way that you would use oleobject, except it now has scripts you can use to respond to the events occurring on the ole application. There's no passing the application object back to PB, PB is handling it on it's own.