GDI sprite (Win32 API)

Please help... how can I make sprite (simple picture moving when pressed arrows)

I thought something like this:
when arrow pressed, then
1) delete previous picture from screen
2) calculate new coordinates
3) show picture using BitBlt()

I have done step 2 and step 3 (it works), put how can I do step 1 -> "delete" previous picture from screen? Or is there any better way making sprite?

I have tried to delete previous picture using rectangle ->
FillRect(..., ..., GetStockObject(WHITE_BRUSH)); but thats no solution what if the background is a image?... and using this the picture starts to blink.

As mentioned by ay_okay, this should be under the Windows or Game message boards.

First, I'd just like to point out:

Code:

CancelDC(hDC);
ReleaseDC(hWnd, hDC);

You don't want these two lines here. Every time you call point(), in other words whenever you have an arrow pressed down, you:

1) Try to draw something
2) Cancel drawing it, although (I think) that only works if called from a different thread
3) Release your HDC, so you can't use it anymore

Number 1 is OK. #2 is pointless if not harmful, and #3 is sinister.

Next, you have your if(KEYSTATE) stuff in the wrong place - it's in the Window procedure, which is NOT called in each frame. I'd be surprise if you didn't get jerky and unpredictable movement. You'll need to modify your while(GetMessage()) loop to use PeekMessage() with the PM_REMOVE flag, and then get it to pump your if(KEYSTATE) code only after all pending messages have already been handled by TranslateMessage() and DispatchMessage(). Note that your if(KEYSTATE) code goes together with the message loop, NOT inside the window procedure. Also, after your message loop, you need to clean up your HDC and HBITMAP (not inside the Window procedure).

After you've got that fixed up, you can solve the flickering problem by reading about double-buffering. It involves having a separate HDC that you draw everything to (first draw the background, then draw your sprites on top of the background) each frame, and after you're done drawing on it, you BitBlt the entire HDC to your main window.