I get an error: Debug Assertion Failed at my myDC.DrawText? If I remove that line, the graphics work fine.
CPaintDC dc(this);
CBitmap myBmp;
CDC myDc;
HANDLE h = ::LoadImage(NULL,"C:\\lady.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
myBmp.Attach(h);
myDc.DrawText("Hello",CRect(10,10,100,30),DT_CENTER); // Debug Assertion Failed
myDc.CreateCompatibleDC(&dc);
myDc.SelectObject(&myBmp);
dc.BitBlt(20,10,436,363,&myDc,0,0,SRCCOPY);
You're drawing the text before actually creating the DC. Move the DrawText line below the CreateCompatibleDB line.