I have a COM method which returns a MFC CRect
:
GetMFCRect(LONG* pRect)
*((CRect*)pRect) = m_currentRect;
In my .NET application I try the following:
int pointer = new int();
Rectangle rc;
IntPtr pIntResult;
unsafe
{
int* p = &pointer;
_COMobj.GetMFCRect(ref *p);
pIntResult = new IntPtr(p);
rc = (Rectangle)Marshal.PtrToStructure(pintResult, typeof(Rectangle));
}
But rc
has the wrong values. What is wrong with this code?
Thanks!