Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can a struct (UDT) be used as an [out] parameter

Status
Not open for further replies.

BolandB

Programmer
May 30, 2001
2
IE
Hi guys,

I have a component built with ATL which has a method defined like this in the IDL file:-


HRESULT MyMethod([in] InputStruct *pInputs, [in, out] ResultsStruct **ppResults);


The client application works ok prior to the component being installed in an MTS package (i.e. works ok when used as in-process DLL within base client - no marshalling required).


When I install the component into an MTS package, the base client gives an "Interface not supported" message.

The client is written in Delphi 5.

Any suggestions as to how I can fix this would be much appreciated.

Also, how can a VB client use same method?

Thanks
Brendan
 
I try not to use UDTs for passing between components. But when I can't get around it, I serialize my UDT into a string. I used to do this by converting it into a fixed-format string (i.e. position 1..10 is the primary key, 11..19 is the modified time, etc), but since I discovered XML I'm using XML for this.

Chip H.
 
Thanks for that ChipH.

A sample would be very useful.

Regards
Brendan

 
Sorry, I don't know Delphi/Pascal. But it's pretty easy to convert a UDT to a string. You just append each element of the UDT to the string using a fixed-width for each. Any numeric elements get converted to strings as well.

On the other end, you parse the string apart, converting numerics back into ints, longs, etc.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top