In the end I used double buffering. I added a [CODE]case WM_ERASEBKGND:
{
return 1;
break;
}[/CODE] To the case section. I changed [CODE]InvalidateRect(hwnd, NULL, TRUE);[/CODE] to [CODE]InvalidateRect(hwnd, NULL, FALSE);[/CODE] and I added [CODE]RECT rcClient;
GetClientRect(hwnd,&rcClient);
//Create a device context that is compatible with the window
HDC hMemDC;
hMemDC = ::CreateCompatibleDC(hdc);
// Verify that the device context was created
if (hMemDC == NULL) {
::MessageBox(NULL, T("CreateCompatibleDC Failed"), T("Error"), MB_OK);
return false;
}
HBITMAP hBitmap = CreateCompatibleBitmap(hdc,rcClient.right, rcClient.bottom);
int savedDC = SaveDC(hMemDC);

SelectObject(hMemDC,hBitmap);
LoadAndBlitBitmap(hMemDC, T("Rocket.bmp"), 0, 0);
LoadAndBlitBitmap(hMemDC,
T("Rocket2.bmp"), pos.x, pos.y);;RestoreDC(hMemDC,savedDC);

DeleteObject(hBitmap);
DeleteObject(hMemDC);[/CODE]

I've found the answer. The LoadAndBlitBitmap code was fine, but I needed to add some code too the paint section. This is the code I added.
[CODE] RECT rcClient;
GetClientRect(hwnd,&rcClient);
//Create a device context that is compatible with the window
HDC hMemDC;
hMemDC = ::CreateCompatibleDC(hdc);
// Verify that the device context was created
if (hMemDC == NULL) {
::MessageBox(NULL, T("CreateCompatibleDC Failed"), T("Error"), MB_OK);
return false;
}
HBITMAP hBitmap = CreateCompatibleBitmap(hdc,rcClient.right, rcClient.bottom);
int savedDC = SaveDC(hMemDC);

SelectObject(hMemDC,hBitmap);
LoadAndBlitBitmap(hMemDC, T("Rocket.bmp"), 0, 0);
LoadAndBlitBitmap(hMemDC,
T("Rocket2.bmp"), pos.x, pos.y); BitBlt(hdc,0,0,rcClient.right,rcClient.bottom,hMemDC,0,0,SRCCOPY);

RestoreDC(hMemDC,savedDC);

DeleteObject(hBitmap);
DeleteObject(hMemDC); [/CODE]

Is there something in these lines that isn't right?

I changed that and it didn't work. I think it may be to do with these lines
[CODE] bool LoadAndBlitBitmap(HDC hWinDC, LPCWSTR szFileName, int x, int y)

HBITMAP hbmBuffer;
hbmBuffer= ::CreateCompatibleBitmap(hWinDC, rcClient.right, rcClient.bottom); [/CODE]

This is what I have done to the code:
[CODE] bool LoadAndBlitBitmap(HDC hWinDC, LPCWSTR szFileName, int x, int y)
{
RECT rcClient;
GetClientRect(hwnd, &rcClient);

// Load the bitmap image file
HBITMAP hBitmap;

hBitmap = (HBITMAP)::LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0,
    LR_LOADFROMFILE);
// Verify that the image was loaded
if (hBitmap == NULL) {
    ::MessageBox(NULL, __T("LoadImage Failed"), __T("Error"), MB_OK);
    return false;
}

// Create a device context that is compatible with the window
HDC  hdcBuffer;
hdcBuffer = ::CreateCompatibleDC(hWinDC);

HBITMAP hbmBuffer;
    hbmBuffer= ::CreateCompatibleBitmap(hWinDC, rcClient.right, rcClient.bottom);
// Verify that the device context was created
if ( hdcBuffer == NULL) {
    ::MessageBox(NULL, __T("CreateCompatibleDC Failed"), __T("Error"), MB_OK);
    return false;
}

// Get the bitmap's parameters and verify the get
BITMAP qBitmap;
int iReturn = GetObject(reinterpret_cast<HGDIOBJ>(hBitmap), sizeof(BITMAP),
    reinterpret_cast<LPVOID>(&qBitmap));
if (!iReturn) {
    ::MessageBox(NULL, __T("GetObject Failed"), __T("Error"), MB_OK);
    return false;
}

// Select the loaded bitmap into the device context
HBITMAP hbmOldBuffer = (HBITMAP)::SelectObject(hdcBuffer, hdmBuffer);
if (hbmOldBuffer == NULL) {
    ::MessageBox(NULL, __T("SelectObject Failed"), __T("Error"), MB_OK);
    return false;
}

// Blit the dc which holds the bitmap onto the window's dc
BOOL qRetBlit = ::BitBlt(hWinDC, x, y, rcClient.right, rcClient.bottom,
    hdcBuffer, 0, 0, SRCCOPY);
if (!qRetBlit) {
    ::MessageBox(NULL, __T("Blit Failed"), __T("Error"), MB_OK);
    return false;
}

// Unitialize and deallocate resources
::SelectObject(hdcBuffer, hbmOldBuffer);
::DeleteDC(hdcBuffer);
::DeleteObject(hbmBuffer);
return true;

} [/CODE]
It doesn't work. I get the error 'error C2065: 'hdmBuffer' : undeclared identifier'

Sorry, I didn't explain very well. This code works but it doesn't double buffer. I took out all of the code that should have made it double buffer as it didn't work. I need help making this code double buffer.

This is the code I am trying to adapt:
[CODE] bool LoadAndBlitBitmap(HDC hWinDC, LPCWSTR szFileName, int x, int y)
{
// Load the bitmap image file
HBITMAP hBitmap;
hBitmap = (HBITMAP)::LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE);
// Verify that the image was loaded
if (hBitmap == NULL) {
::MessageBox(NULL, T("LoadImage Failed"), T("Error"), MB_OK);
return false;
}

// Create a device context that is compatible with the window
HDC hLocalDC;
hLocalDC = ::CreateCompatibleDC(hWinDC);
// Verify that the device context was created
if (hLocalDC == NULL) {
    ::MessageBox(NULL, __T("CreateCompatibleDC Failed"), __T("Error"), MB_OK);
    return false;
}

// Get the bitmap's parameters and verify the get
BITMAP qBitmap;
int iReturn = GetObject(reinterpret_cast<HGDIOBJ>(hBitmap), sizeof(BITMAP),
    reinterpret_cast<LPVOID>(&qBitmap));
if (!iReturn) {
    ::MessageBox(NULL, __T("GetObject Failed"), __T("Error"), MB_OK);
    return false;
}

// Select the loaded bitmap into the device context
HBITMAP hOldBmp = (HBITMAP)::SelectObject(hLocalDC, hBitmap);
if (hOldBmp == NULL) {
    ::MessageBox(NULL, __T("SelectObject Failed"), __T("Error"), MB_OK);
    return false;
}

// Blit the dc which holds the bitmap onto the window's dc
BOOL qRetBlit = ::BitBlt(hWinDC, x, y, qBitmap.bmWidth, qBitmap.bmHeight,
    hLocalDC, 0, 0, SRCCOPY);
if (!qRetBlit) {
    ::MessageBox(NULL, __T("Blit Failed"), __T("Error"), MB_OK);
    return false;
}

// Unitialize and deallocate resources
::SelectObject(hLocalDC, hOldBmp);
::DeleteDC(hLocalDC);
::DeleteObject(hBitmap);
return true;

}
[/CODE]
Everything I do seems to do nothing.
This the code in the paint section.
[CODE] LoadAndBlitBitmap(hdc, __T("Rocket2.bmp"), pos.x, pos.y); [/CODE]

What do I put in instead of prc->right?

Which is better Double Buffering or assigning to a Static Control. I would like an example of double buffering or both.
This is my bitmap code.

[CODE] #include <windows.h>

include <tchar.h>
include <stdlib.h>
include <string.h>
include "Menu.h"
include "Icon.h"

LPCTSTR ClsName = L"App"; // Class name
LPCTSTR WndName = L"WindowsAPI"; // Window title
HWND hwnd; // Handle to our main window

////////////////////////////////////////////////////

LRESULT CALLBACK WndProcedure(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);

////////////////////////////////////////////////////

               INT WINAPI WinMain(HINSTANCE hInstance, 
               HINSTANCE,
               LPSTR lpCmdLine, 
               int nCmdShow)

{
MSG Msg; // Structure to hold messages for our WinProc
WNDCLASSEX WndClsEx; // Our WNDCLASSEX structure used to define a window

// Define our window
WndClsEx.cbSize          = sizeof(WNDCLASSEX);                                  // The size in bytes of the structure
WndClsEx.style           = CS_HREDRAW | CS_VREDRAW;                             // Style flags: CS_HREDRAW | CS_VREDRAW redraws the window on resize
WndClsEx.lpfnWndProc     = WndProcedure;                                        // Pointer to the windows procedure
WndClsEx.cbClsExtra      = 0;                                                   // Extra bytes to allocate the window class structure
WndClsEx.cbWndExtra      = 0;                                                   // Extra bytes to allocate the window instance structure
WndClsEx.hIcon           = LoadIcon(hInstance, (LPCTSTR)IDI_ICON);              // A handle to the window class's icon 
WndClsEx.hCursor         = LoadCursor(NULL, IDC_ARROW);                         // A handle to the window class's cursor, this uses default
WndClsEx.hbrBackground   = (HBRUSH)GetStockObject(WHITE_BRUSH);                 // A handle to the brush used to paint the background, we use white
WndClsEx.lpszMenuName    = MAKEINTRESOURCE(IDR_MAIN_MENU);                      // We use the menu we created (IDR_MAIN_MENU)       
WndClsEx.lpszClassName   = ClsName;                                             // Class name
WndClsEx.hInstance       = hInstance;                                           // handle to the instance that contains the WinProc for the class
WndClsEx.hIconSm         = LoadIcon(WndClsEx.hInstance, (LPCTSTR)IDI_ICON);     // A ...

Could you give me some help with double buffering. From what I've heard, that's the best solution to the problem.

Thanks, It worked but does it matter if you don't load the bitmap as a resource. I didn't. I know how to select the one I want to move. All I need to do now is to stop it flickering. Which is better, assigning them to static controls or to use double buffering?

Could I use a bool statment?

[QUOTE=strmstn;1170942]I see you are drawing the bitmaps directly. Then you'll have to get the arrow keystrokes from the main window and then determine which bitmap is to be moved. Perhaps you could get mouse pointer coordinates at a WM_LBUTTONDOWN message and then decide which bitmap is to get attention.[/QUOTE]

Could you give an example. Isn't WM_LBUTTONDOWN for mouse clicks?

lines 143, 144 corresponds with line 185. If you wanted to you could delete lines 143, 144 and replace x any on line 185 with two numbers.

These are my resources

I have no idea how to move a bitmap with the arrow keys.
Here is my code
[CODE] #include <windows.h>

include <tchar.h>
include <stdlib.h>
include <string.h>
include "Menu.h"
include "Icon.h"

LPCTSTR ClsName = L"App"; // Class name
LPCTSTR WndName = L"WindowsAPI"; // Window title
HWND hwnd; // Handle to our main window

////////////////////////////////////////////////////

LRESULT CALLBACK WndProcedure(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);

////////////////////////////////////////////////////

               INT WINAPI WinMain(HINSTANCE hInstance, 
               HINSTANCE,
               LPSTR lpCmdLine, 
               int nCmdShow)

{
MSG Msg; // Structure to hold messages for our WinProc
WNDCLASSEX WndClsEx; // Our WNDCLASSEX structure used to define a window

// Define our window
WndClsEx.cbSize          = sizeof(WNDCLASSEX);                                  // The size in bytes of the structure
WndClsEx.style           = CS_HREDRAW | CS_VREDRAW;                             // Style flags: CS_HREDRAW | CS_VREDRAW redraws the window on resize
WndClsEx.lpfnWndProc     = WndProcedure;                                        // Pointer to the windows procedure
WndClsEx.cbClsExtra      = 0;                                                   // Extra bytes to allocate the window class structure
WndClsEx.cbWndExtra      = 0;                                                   // Extra bytes to allocate the window instance structure
WndClsEx.hIcon           = LoadIcon(hInstance, (LPCTSTR)IDI_ICON);              // A handle to the window class's icon 
WndClsEx.hCursor         = LoadCursor(NULL, IDC_ARROW);                         // A handle to the window class's cursor, this uses default
WndClsEx.hbrBackground   = (HBRUSH)GetStockObject(WHITE_BRUSH);                 // A handle to the brush used to paint the background, we use white
WndClsEx.lpszMenuName    = MAKEINTRESOURCE(IDR_MAIN_MENU);                      // We use the menu we created (IDR_MAIN_MENU)       
WndClsEx.lpszClassName   = ClsName;                                             // Class name
WndClsEx.hInstance       = hInstance;                                           // handle to the instance that contains the WinProc for the class
WndClsEx.hIconSm         = LoadIcon(WndClsEx.hInstance, (LPCTSTR)IDI_ICON);     // A handle to the window class's small icon 
// If ...