Answer the question
In order to leave comments, you need to log in
Can't return string from COM (Delphi)?
There is a task to write a COM server, it should have a string at the output.
This is what the interface looks like in the _TLB.pas file
// *********************************************************************//<br/>
// Interface: ITMyCOM<br/>
// Flags: (256) OleAutomation<br/>
// GUID: {D94769D0-F4AF-41E9-9111-4D8BC2F42D69}<br/>
// *********************************************************************//<br/>
ITMyCOM = interface(IUnknown)<br/>
['{D94769D0-F4AF-41E9-9111-4D8BC2F42D69}']<br/>
function MyDrawWS(a: Integer; b: Integer): WideString; stdcall;<br/>
end;<br/>
[<br/>
odl,<br/>
uuid(D94769D0-F4AF-41E9-9111-4D8BC2F42D69),<br/>
version(1.0),<br/>
helpstring("Interface for TMyCOM Object"),<br/>
oleautomation<br/>
]<br/>
interface ITMyCOM : IUnknown {<br/>
BSTR _stdcall MyDrawWS(<br/>
[in] long a, <br/>
[in] long b);<br/>
};<br/>
function TTMyCOM.MyDrawWS(a, b: Integer): WideString;<br/>
begin<br/>
Result := WideString(IntToStr(a+b));<br/>
end;<br/>
Edit1.Text := String(MyCOM.MyDrawWS(1,1));<br/>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question