A
Arsalan Ahmad
Hi all,
I have written a simple COM object in ATL, one of whose methods is:
STDMETHOD(Write)(/*[in]*/BYTE *buffer, /*[in]*/long count,
/*[out,retval]*/long *bytesWrite);
I have implemented the method as:
STDMETHODIMP CMyControl::Read(BYTE *buffer, long count, long *bytesRead)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
strcpy(buffer, "this is a test");
*bytesRead = count;
return S_OK;
}
The problem is when I try to use it in .NET framework (using C#) like this:
byte[] buffer = new buffer[25];
int count;
IMyControl mc = new MyControlLib.CMyControl();
mc.Read(ref buffer, buffer.Length, count);
I am getting following error:
1. The best overloaded method match for MyControlLib.IMyControl.Read(ref
byte, int)' has some invalid arguments
2. Argument '1': cannot convert from 'ref byte[]' to 'ref byte'
Please tell me how can I resolve this issue.
Thanks,
Arsalan Ahmad
I have written a simple COM object in ATL, one of whose methods is:
STDMETHOD(Write)(/*[in]*/BYTE *buffer, /*[in]*/long count,
/*[out,retval]*/long *bytesWrite);
I have implemented the method as:
STDMETHODIMP CMyControl::Read(BYTE *buffer, long count, long *bytesRead)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
strcpy(buffer, "this is a test");
*bytesRead = count;
return S_OK;
}
The problem is when I try to use it in .NET framework (using C#) like this:
byte[] buffer = new buffer[25];
int count;
IMyControl mc = new MyControlLib.CMyControl();
mc.Read(ref buffer, buffer.Length, count);
I am getting following error:
1. The best overloaded method match for MyControlLib.IMyControl.Read(ref
byte, int)' has some invalid arguments
2. Argument '1': cannot convert from 'ref byte[]' to 'ref byte'
Please tell me how can I resolve this issue.
Thanks,
Arsalan Ahmad