I have a really basic program that's only job is to fill a window with pixels of random color in random places. I do this with SetPixel() placed inside my windows procedure (just to make sure this happens a lot, probably not the best way, I know). Things seem to work fine, but when I move the window or resize it, etc. the entire screen clears and I don't understand why. Also, why is DirectX faster than GDI? What does DirectX use that makes it run faster and how can I access it?