It is very peculiar, and it has been making me wonder. At times, it almost seems inconsistent, almost even as if it's not sending the WM_PAINT message at all.
Here is an image which demonstrates what I am referring to; The blue rectangle doesn't exist (the window simply has not been updated for some reason):

void IMAGE::update(HWND& hwnd, int frame) {
RECT repaint = area;
repaint.top -= frame;
repaint.left -= frame;
repaint.right += frame;
repaint.bottom += frame;
if (InvalidateRect(hwnd, &repaint, TRUE) == 0) {
std::stringstream ss;
ss << "ERROR: InvalidateRect() returned 0\n";
OutputDebugString(ss.str().c_str());
}
}
To that I answer: No. I am drawing the rectangles, then updating the specific areas.
The second question I'm assuming I'll be asked is: Are you updating the region that includes the rectangle?
To that I answer: Yes! I am updating the actual rectangle (square) + 2 pixels (to cover the rectangle).
The third question I'm assuming I'll be asked is: When is it occurring?
To that I answer: During the first selection. There are ~100 images like those above (from a video game).
The fact that it works after the initial selection is what makes me wonder the most!
What or where could this possibly be occurring at (in the code, if at all), and why?
EDIT: I found the culprit! It was a crafty comment... Haha.
I think this is a tall tale sign that I need to get to bed.
Edited by Hyper, 10 April 2012 - 09:34 AM.












