Here is the code to double buffer in c++ in windows GDI graphics
	this code goes in your window procedure in the WM_PAINT message handler
	NOTE: you may need to set the window background not to draw itself 
	before you register the window class:

	RECT Client_Rect;
	int win_width = Client_Rect.right - Client_Rect.left;
	int win_height = Client_Rect.bottom + Client_Rect.left;
	HDC Memhdc;
	HDC hdc;
	HBITMAP Membitmap;
	hdc = BeginPaint(hWnd, &ps);
	Memhdc = CreateCompatibleDC(hdc);
	Membitmap = CreateCompatibleBitmap(hdc, win_width, win_height);
	SelectObject(Memhdc, Membitmap);
	//drawing code goes in here
	BitBlt(hdc, 0, 0, win_width, win_height, Memhdc, 0, 0, SRCCOPY);
	DeleteDC    (Memhdc);
	DeleteDC    (hdc);
	EndPaint(hWnd, &ps);

	Basically this is whare you are doing:
	1  Make a copy of the device context that is the same format as the 
	default one that is showing (the device context is the object you draw to)
	2  Copy what is in the on screen dc to your copied dc
	3  Draw on the copy
	4  Put what is in the copy back onto the original dc which gets displayed