-2

I was stuck on a program I was writing and figured it couldn't hurt to ask here. The program is in C#. I'm using a command that is confusing me slightly. In C#, the command is:

scanner.DirectIO(int x, int y, object z);

But when I looked up the documentation for the command, it was:

scanner.DirectIO(long x, long* y, BSTR* z); //z needs to have (some number) of bytes allocated

The problem I have is that C# has no equivalent to BSTR*. This code is supposed to put a bstr of a bitmap into z. I'm not too worried about x or y for now. I tried passing it a byte[] of the size needed, but that didn't work. I'm considering using something like:

IntPtr z = SysAllocStringByteLen(null, size);

but I'm not sure if that is what I want just yet. Any advice? Thanks!

EDIT: I found a similar question but it doesn't tell me about how to pass a BSTR*, just a BSTR: Convention for passing BSTRs into COM functions from C# (COM interop)

EDIT: DirectIO is a method of the Scanner class in microsoft.pointofservice. Where the second declaration with BSTR came in was from documentation on the specific scanner.

Community
  • 1
  • 1
  • possible duplicate of [Convention for passing BSTRs into COM functions from C# (COM interop)](http://stackoverflow.com/questions/7033375/convention-for-passing-bstrs-into-com-functions-from-c-sharp-com-interop) – Pieter Geerkens Jul 13 '14 at 15:05
  • Well, that's not close to being correct. It looks like a COM method but that gets never mangled this badly. You have to be more explicit about exactly how this declaration got generated. – Hans Passant Jul 13 '14 at 15:23
  • I'll edit it to reflect that. – user3834440 Jul 13 '14 at 18:25

1 Answers1

-1

Problem solved. I used C++ instead.