on 04-05-2016 10:20 PM
I've used COM wrapped ,NET dlls a lot, but up until now I've only returned simple datatypes like string and boolean. I now would like to return a class / structure, something like:
Class ConnectionInfo
Boolean IsConnected
String URL
ConnectionInfo IsConnected
{
.
.
return connectionInfo
}
Powerbuilder code is currently something like this:
str_sharepoint_site lstr_site
lany = iole_xml.IsConnected() <-- This works as I put a bunch of MessageBox.Shows in the C# code and it gets all the way to the end of the call
lstr_site = lany <-- Crashes here saying "Cannot convert oleobject in Any variable to str_sharepoint"
str_sharepoint is a boolean and a string
However, due to old age, long working hours, and a fear of early onset dementia I'm drawing a blank on to get the result from the call in Powerbuilder into a structure. I can get it into an OLEObject or an ANY variable, but can't think what to do with it then.
Any help much appreciated!
Thank you.
Okay I seem to have solved it. It doesn't seem a very nice solution to me, but it works at least.
So I retrieve the COM method into an OLEObject I them put each property into the desired structure like so:
ltr_sharepoint_site lstr_site
OLEOBject lole
lole = CREATE OLEObject
lole = iole_xml.DoStuff()
// Extract the results from the OLEObject into my structure
lstr_site.sb_is_connected = lole.IsConnected
lstr_site.ss_url = lole.URL
It requires the PB programmer to know the names of the properties in the C# code which is a shame, it would be nice to just assign like so lstr_site = iole_xml.DoStuff() but I can live with it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay read that, but I don't think it really applies here. Just to be clear I am not calling a web service, just a straightforward C# dll that has been COM wrapped. So there's no need for passing XML or encoding in Base64. I suspect I am missing something really simple as I'm not trying to do anything particularly complicated.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.