
Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Mattias,
Thank you for your response, and I hope you may still be watching this thread.
I have previously tried the code in the link you recommended, and have
created a number of variations, including fixing a pointer to the array,
using Marshal.AllocCoTaskMem to allocate memory for the array, etc.
When using the method described in the link
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconeditinginteropassembly.asp
the method call fails and a System.Runtime.InteropServices.COMException
occurs in mscorlib.dll, with the Additional information: Type Mismatch.
When the method of the OCX returns succesfully (no error), only the first
value in the array is passed back. Even with the untouched interop assembly
generated by aximp, this is the case, although I can not use an array larger
than 4 items.
Using OLEView, the the method looks like:
VARIANT_BOOL DetectCode(long* codeArray, short* arraySize)
The orginal IL of the interop assembly generated by aximp looks like:
instance bool DetectCode(int32& codeArray, int16& arraySize) runtime managed
preservesig internalcall
When the method is called, codeArray is intialized, and contains all 0's.
arraySize is the number of elements in codeArray. If the method call is
succesful, it returns true, and codeArray contains a number of values up to
the size set in arraysize, and arraySize is the actual (useful) number of
elements in the array.
Thanks in advance for your help.
John
"Mattias Sjögren" wrote:
> You don't clearly state what the problem is, but I assume it's the
> fact that the array parameter appears as a single ref parameter
[quoted text clipped - 8 lines]
>
> Mattias
MarkM - 13 Jan 2005 20:45 GMT
I am having this exact problem. Did you ever solve it? What is the solution?
Mark
> Mattias,
>
[quoted text clipped - 47 lines]
> >
> > Mattias