I'm new to C++ and do not understand why I am getting the error "Access Violation Reading Location". Here is my code:
gdiscreen();
int startX = 1823 - minusX;
int startY = 915 - minusY;
for (int i = startX; i < startX + 61; i++)
{
for (int j = startY; j < startY + 70; j++)
{
Color pixelColor;
bitmap->GetPixel(i, j, &pixelColor);
cout << pixelColor.GetValue() << " ";
}
cout << endl;
}
gdiscreen() can be found here: http://forums.codeguru.com/showthread.php?476912-GDI-screenshot-save-to-JPG
minusX
andminusY
? Did you check whether you are accessing with validi
andj
coordinates? – Terrazzobitmap
is not what you think it is. Do some debugging. Make a testcase. – Ruck