I am developing a capture application with Magnification API. The program is to capture of both primary and Seconday Screen. Sometimes access violation occur when MagSetWindowSource function called.
1. The error is
First-chance exception at 0x7fefeb257c9 in test01.exe: 0xC0000005: Access violation reading location 0x0afff660.
2. My Developing Environment is
OS : windows 7 64bits
Video : NVIDIA Geforce GT 520 , Dual Monitor(Primary 1280x1024, Secondary 1920x1080)
Application : 32bit application.
3. My test code is
if (!MagSetWindowFilterList(hwndMag, MW_FILTERMODE_EXCLUDE, 1, pFilterList))
{ return;
}
RECT sourceRect;
sourceRect.top = 0;
sourceRect.left = m_ScreenX;
sourceRect.right = m_ScreenX + m_ScreenW;
sourceRect.bottom = m_ScreenH;//m_ScreenY;
if (!MagSetWindowSource(hwndMag, sourceRect))// Access violation frequently. The value of sourceRect is valid.
{
return;
}
//The reference of this source is http://www.codeproject.com/Articles/607288/Screenshot-using-the-Magnification-library
Please help me. I'dont know why error occur sometimes.
Thank for reading it.