I have a COM class which has the following function in one of its interface.
HRESULT Decode([in] BSTR bstrEncodedData, [out] LONG *plSize, [out,size_is(,
*plSize)] BYTE **ppbData);
I created the wrapper class using Add Reference in solution explorer and the
function COM definition now changed as follows in DOTNET.
In Wrapper class
void Decode ( string bstrData , int nSize , System.IntPtr ppData )
As we can see..BYTE ** ppbData has been changed to System.IntPtr ppData.
Now the problem is .How to call this Double pointer.in Dotnet......Any idea?
I am using this code.........but I don't klnow how to access the return
value from ptrOutPutData.
I tried many ways but always I get some garbage values....
===========================================================
private void Button1_Click(object sender, System.EventArgs e)
{
unsafe
{
byte[] pB = new byte[str.Length];
int count;
SomeFunction(ref pB, out count);
ASCIIEncoding Encoding = new ASCIIEncoding();
string content = Encoding.GetString(pB,0,count);
MessageBox.Show(content);
}
}
public unsafe void SomeFunction(ref byte[] buffer, out int count)
{
fixed (byte* p = buffer)
{
string str= TextBox4.Text;
System.IntPtr ptrOutPutData = (System.IntPtr)p;
count =0;
SomeCOMClass obj = new SomeCOMClass();
try
{
obj.Decode(str, out count, ptrOutPutData);
}
catch(Exception ee)
{
MessageBox.Show(ee.Message.ToString());
}
}
}
===================================
This list is hosted by DevelopMentor� http://www.develop.com
NEW! ASP.NET courses you may be interested in:
2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet
Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet
View archives and manage your subscription(s) at http://discuss.develop.com