Have a C++ ActiveX OCX with the following ODL declaration:
DISP_FUNCTION(CHellerCommCtrl, "GetRecipePath", GetRecipePath, VT_I4, VTS_PBSTR)
Need to call GetRecipePath from C# program and convert resultant C++ BSTR to C# string. Am aware, from other posts, of the following solution:
string s1 = Marshal.PtrToStringAnsi((IntPtr)outPtr);
Problem is, the prototype for GetRecipePath in C# via interop has argument "ref string" and will not permit me to typecast the resultant "string" to "IntPtr" and then pass that to the Marshal method. How to convert the "string" obtained from GetRecipePath [which is really a BSTR] to a C# string?