VC++ ATL Server, VB Client, VARIANTs and SAFEARRAYs ??
-
COM. I realize that I have to use automation-compatible data types such as VARIANTs and SAFEARRAYs. However, I'm having difficulty figuring-out exactly how to define the method in IDL and interpret the data on the server side. The data is a set of 29 variables, most of which are integers. Some are floats, with one string and couple of arrays thrown in for good measure. Obviously it would be tedious to set-up and use a method with 29 parameters. So, I'd like to pass all of the data in one chunk if I can. Additionally, there will be 2 other chunks of data returned to the client in the same method ... but that's a different question. The only thing I'm trying to do now is get the chunk of data to the server. In all that I've read, it seems that the best way to pass the chunks of data is using arrays of VARIANTs. Is that true ? If so, how do I define the method interface in IDL and how do I unpack the data on the server ? Any guidance would be helpful. Thank you, Keith Gemeinhart
-
COM. I realize that I have to use automation-compatible data types such as VARIANTs and SAFEARRAYs. However, I'm having difficulty figuring-out exactly how to define the method in IDL and interpret the data on the server side. The data is a set of 29 variables, most of which are integers. Some are floats, with one string and couple of arrays thrown in for good measure. Obviously it would be tedious to set-up and use a method with 29 parameters. So, I'd like to pass all of the data in one chunk if I can. Additionally, there will be 2 other chunks of data returned to the client in the same method ... but that's a different question. The only thing I'm trying to do now is get the chunk of data to the server. In all that I've read, it seems that the best way to pass the chunks of data is using arrays of VARIANTs. Is that true ? If so, how do I define the method interface in IDL and how do I unpack the data on the server ? Any guidance would be helpful. Thank you, Keith Gemeinhart
Hi Keith, You absolutely right... You have an option of passing 29 parameters to the method or you can use safearray. But safearrays are difficult to work with if you have different type of data like integers and strings... The third option you have, which is the best if you have very complicated data that you need to pass/return to/from the method, is to use a COM object. You create a COM object with the different type of properties and pass/return it by interface pointer. The big advantage is that you can access the properties by names and even associate help strings with each property. The only issue is the performance... if you need to make many calls to such a method, it will take a lot of time to create and initialize the parameters object. Regards, Alex Gorev, Dundas Software.
-
Hi Keith, You absolutely right... You have an option of passing 29 parameters to the method or you can use safearray. But safearrays are difficult to work with if you have different type of data like integers and strings... The third option you have, which is the best if you have very complicated data that you need to pass/return to/from the method, is to use a COM object. You create a COM object with the different type of properties and pass/return it by interface pointer. The big advantage is that you can access the properties by names and even associate help strings with each property. The only issue is the performance... if you need to make many calls to such a method, it will take a lot of time to create and initialize the parameters object. Regards, Alex Gorev, Dundas Software.