Aug 25, 2008 at 4:41pm UTC
Hi,
is there any way to get data back from OLE which is build in C++ and I am trying to get data from it using C# code?
following is some of my code .
public unsafe Int32 OLESendCommand(Int32 subsys, Int32 cmd, Int32 reg8, Int32 dataout,
Int32* resultinformation,ref byte[] recvbuffer) //buffer 8 deep
{
Int32 result;
byte[] buffer_1 = new byte[8];
byte[] buffer_2 = new byte[8];
try
{
//C++ code //result = V.OleFunction("SendCommandTemp", UsingTunnel,
//DeviceAddress, subsys, cmd, reg8, dataout, resultinformation,
//ref recvbuffer[0], ref recvbuffer[4]);
result = (Int32)V.GetType().InvokeMember("SendCommandTemp", System.Reflection.BindingFlags.InvokeMethod, null, V,
new object[] { UsingTunnel, DeviceAddress, subsys, cmd, reg8, dataout,(Int32)resultinformation,
recvbuffer[0], recvbuffer[4] });
(ii) Can C# ref can able to get data from C++ OLE (insted of using pointer ,I used ref in C#)
Regards,
Atul Baxi
Aug 25, 2008 at 8:24pm UTC
Are you familiar with .NET Interops? Have a read up on these and see if this will solve you problem. I have used other language libraries in C# by building an interop for them. Then they can be imported and used just like any other component.
Aug 28, 2008 at 3:08pm UTC
Hi Zaita,
Can U send sample code which U had tried so that I can get idea about using Interop?
Thanks in advance
Atul
Aug 28, 2008 at 7:39pm UTC
No.
Interop is just a wrapper .NET puts around a non-.NET DLL so you can use it in .NET development.