Posted on May 17, 2011 at 14:10 Those 'ref' s look wrong. That would imply 'LPBYTE*' (a pointer to LPBYTE). A preallocated byte[] should suffice. IOW, just remove the 'ref' keyword from both definitions of the P/Invoke methods.
Posted on May 17, 2011 at 14:10 There used to be a nice section on MSDN (cant recall URL). Else you can try pinvoke.net, but be warned, many examples are just plain wrong.
That definately solved the problem! Now the data looks like it is supposed to when I listen to the com-port. I dunno where I got the ref part from. Is there any good translation tables for datatypes somewhere?
Well those are the ones I am trying to avoid ;) Anyway thanks for the help! Your advice and a driver update on my USB to ComPort adapter seemed to do the trick.