Hi Jeff,
Why not redefine the C++ structure in the C# which will save a lot of job
to do the interop.
Also here is a sample you may take a look.
[MCPP]
typedef struct TestSC
{
int i;
int j;
}SCC;
using namespace System;
using namespace System::Runtime::InteropServices;
namespace TestMCPPMC
{
public __gc class TestClass
{
public:
int i;
int j;
TestClass(Byte bts[])
{
SCC tx;
IntPtr pTs=(IntPtr)&tx;
Marshal::Copy(bts,0,pTs,sizeof(SCC));
i = tx.i;
j = tx.j;
}
};
}
[C#]
[STAThread]
static void Main(string[] args)
{
byte[] bts = new byte[8];
bts[0] = 1;
bts[4] = 1;
TestMCPPMC.TestClass tc = new TestMCPPMC.TestClass(bts);
System.Diagnostics.Debug.WriteLine(tc.i);
System.Diagnostics.Debug.WriteLine(tc.j);
}
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Jeff - 07 Sep 2004 11:41 GMT
Hi Peter,
I'll try your MC++ sample code.
Thanks again, Jeff
Jeff - 08 Sep 2004 14:09 GMT
Hi Peter,
Your MCPP sample code seems to work well for me.
Thanks again for your help,
Jeff
"Peter Huang" - 09 Sep 2004 03:36 GMT
Hi Jeff,
I am glad that my suggestion is of help, if you still have any concern,
please feel free to post here.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.