Try using the TAB controls HDC

ie
hdc = GetDC(hTabCrtl);

and its client rect in the paint function

I suggest creating a compat HDC to hold your bmp when the TAB control is created, deleteing it when the TAB control is destroyed. As opposed to creating one every paint.

Unless using a .NET compiler this is a GDI resource leak

if(!SelectObject(SourceDevice, CurrentBitmap))