user3834440
user3834440

Reputation: 11

Method Argument is BSTR* in C#

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.

Upvotes: -2

Views: 408

Answers (1)

user3834440
user3834440

Reputation: 11

Problem solved. I used C++ instead.

Upvotes: -1

Related Questions