Passing in a string for a Bstr* IN parameter in a DLL using CFCOM

  • Thread starter Thread starter Andrew Mac
  • Start date Start date
A

Andrew Mac

I would appreciate some assistance in how to pass a string to a DLL
that has one input parameter of type BSTR*.

I'm using CFCOM's "SetProperty" and this works fine for numeric
parameters or BSTR params but is failing on BSTR* params.

Any ideas as to what is going wrong or what I could do to resolve it
would be gratefully appreciated!
 
This would really depend on the COM method/property signature. I have a bit
of trouble figuring out what kind of propset call would take a BSTR*.
Usually BSTR* would be passed to propget. As for array as you suggest -
wouldn't it have to be SAFEARRAY? I mean we are obviously talking about an
automation interface. I can hardly see how one would use C-style array

--
Alex Feinman
---
Visit http://www.opennetcf.org
Ali said:
try passing the string as a string array (string[] s).

Ali Gardezi

Andrew Mac said:
I would appreciate some assistance in how to pass a string to a DLL
that has one input parameter of type BSTR*.

I'm using CFCOM's "SetProperty" and this works fine for numeric
parameters or BSTR params but is failing on BSTR* params.

Any ideas as to what is going wrong or what I could do to resolve it
would be gratefully appreciated!
 
Hi,

Please find part of the definition of the properties I am trying to set.

interface IMsgQueue : IDispatch {
[id(0x00000001), propget, helpstring("Indicates which queue to
open.")]
HRESULT FormatName([out, retval] BSTR* pVal);
[id(0x00000001), propput, helpstring("Indicates which queue to
open.")]
HRESULT FormatName([in] BSTR* pVal);
[id(0x00000002), propget, helpstring("Indicates which queue to
open.")]
HRESULT PathName([out, retval] BSTR* pVal);
[id(0x00000002), propput, helpstring("Indicates which queue to
open.")]
HRESULT PathName([in] BSTR* pVal);

Thanks

Andrew Mc
 
Who implemented this interface? The standard IMSMQQueueInfo interface has
HRESULT FormatName([in] BSTR pVal);
which makes much more sense. The propset signature should not attempt to
pass a BSTR BYREF. In any case, doesn't CF COMM takes care of marshalling
for you?
 
CFCom does successfully handle the marshalling in 95% of cases but this
appears to be a circumstance it wasn't expecting/can't handle. Odyssey
are investigating but I was curious as to whether anybody else could
beat them to an answer.
 
Back
Top