I need to get a RECT from COM to C # in 64 bits, so I defined a simple method in IDL as:
[id(23), helpstring("method GetRect")] HRESULT GetRect([out,retval] RECT* pRect);
and implemented in C ++ as
STDMETHODIMP CSpot::GetRect(RECT* pRect) { CRect rec = get_position(); *pRect = rec; return S_OK; }
I called in C # like:
tagRECT rec = pSpot.GetRect();
Most of the time is fine, but sometimes I get 0xC0000005: the location of the access violation record is 0x0000000000000000.
in line:
*pRect = rec;
What can cause this exception?
source share