You may want to use AllocCoTaskMem[^] instead (and it's associated free method), but I don't think that is your problem. Looking at the put code:
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int32)) * 10);
Marshal.Copy(buffer, 0, ptr, 10);
int bptr = (int)ptr;
axVecad1.PutExData(ref bptr, 10 * 4);
After the first line, ptr points to the allocated block of memory. The array is then copied to the allocated block. Next ptr is cast to an int, so bptr now holds the correct address to the buffer. Now, when passing in the address to the PutExData, the address of the bptr is passed in (ref bptr). What you really want to pass in is the value of bptr. So really you are passing in a pointer to bptr which has a pointer to the actual data (so a pointer to a pointer). Basically, the signature for the PutExData should have the first parameter as an "IntPtr", not as a "ref Int32". I don't think there is a way to properly pass in the IntPtr address when the signature has the ref value there. Because you would need to create an Int32 value at the same location as the allocated buffer. I realize that VS generated the signature of the method for you (more specifically, aximp.exe generates it). The best work-around (short of hand-writing all the code you need) I found was here[^]. Be sure to read the whole thread, he talks about activeX controls later in the thread. Hopefully this helps. UPDATE: Actually, it looks like aximp.exe can generate C# source code now, so that would probably be your best option.
Take care, Tom ----------------------------------------------- Check out my blog at http://tjoe.wordpress.com