Rectangle disappearing

closed account (LTXN8vqX)
Ok, so i have been experimenting with shapes in winapi for example Rectangle(); i am having a problem with displaying it on RuneScape, it draws then disappears then draws again. I guess it is because the window is refreshing or something, but i want to know how to draw a shape on a game and keep it there constantly without the flickering effect. Help appreciated. Thanks in advance.I tried this code, but same thing
1
2
3
4
while(true)
{
Rectangle(hdc, 500, 500, 450, 450);
}
closed account (LTXN8vqX)
thanks for the replies...(sarcasm, lol)
All drawing to a window in a Win32 Api program should be done in response to a WM_PAINT message. Your rectangle would persist and only need to be drawn once if put there.
closed account (LTXN8vqX)
I am drawing to another window, you would know if you read my first post instead of c & p crap from Charles Petzold's book. I can already draw a rectangle on another window, that's not the problem, i just wanted to know how i could know if the shape was erased due to the window invalidating it's rectangle causing it to repaint.
I am drawing to another window, you would know if you read my first post


I didn't know that from your first post. I mean I see it now that you said that, but in my original reading, my brain skimmed over "RuneScape" because I didn't know what it was so I chose to ignore it.

anyway, the only thing I can think of would be to hook the window procedure -- SetWindowLong and change the window proc to your function, then catch WM_PAINT messages. A WM_PAINT message implies the window has become dirty.

Of course whether or not that works depends on how RuneScape draws. If it doesn't draw in WM_PAINT... or if it's doing rendering with DirectX or something then you might be hosed.
Topic archived. No new replies allowed.