Trying to convert this:
HDC hdc = CreateCompatibleDC(NULL);
HBITMAP cross = (HBITMAP)LoadImage(NULL, _("c:\\captureqwsx.bmp") ,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
SelectObject(hdc, cross);
HDC hdc_x = ::GetDC(HWND_DESKTOP);
::BitBlt(hdc_x,10,10,200,200,hdc,0,0,SRCCOPY);
::ReleaseDC(HWND_DESKTOP,hdc_x);
To this using CDC / DC ???????????
CPaintDC dc(this);
CDC dcMem;
dc.CreateCompatibleDC(&dcMem);
HBITMAP cross = (HBITMAP)LoadImage(NULL, _T("c:\\captureqwsx.bmp") ,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
dc.SelectObject(cross);
dc.BitBlt(10,10,200,200,&dcMem,0,0,SRCCOPY);
dc.ReleaseOutputDC();
You have your DCs mixed up. The CPaintDC is automatically created to work with your window, there’s no need to use CreateCompatibleDC on it – that should be done on your dcMem. Also you can’t use CPaintDC except in a WM_PAINT message handler, you should use CClientDC instead.
There may be other problems with the code you posted, but this should get you started.