I already have a pointer to my temporary hDC containing the bitmap. Okay, this is how you draw a Bitmap to the Main Windows Screen
Code:
HDC hDC;
HANDLE hBitmap;
HWND fWindow;
hDC = CreateCompatibleDC(NULL);
HDC oHand;
hBitmap = LoadImage(0,"C:\\Documents and Settings\\Xei\\Desktop\\Exclusion.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
SelectObject(hDC,hBitmap);
BitBlt(GetDC(0),0,0,5000,5000,hDC,0,0,SRCCOPY);
DeleteDC(hDC);
That will draw a bitmap from a Console application. Now I am trying to do this in MFC, and draw the Bitmap on a PictureBox. So this code is valid for MFC:
Code:
hBitmap = LoadImage(0,"C:\\Documents and Settings\\Xei\\Desktop\\Exclusion.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
SelectObject(hDC,hBitmap);
The line of error is BitBlt Parameter 1. It requires a hDC value. My PictureBox(m_Picture) does not have a variable for hDC such as m_hDC, however it does have m_hWND. We can retreive hDC from the API call GetWindowsDC or GetDC, however in MFC the call is no longer HDC GetDC(hWnd), it is now CDC* GetDC(); now in a CDC variable there is a m_hDC, but I do not know how to obtain this hDC from the picturebox. The following code is an invalid attempt at getting a hDC from my picturebox:
Code:
CDC blah;
blah = m_Picture.GetDC();
//Compile Error: "error C2582: 'CDC' : 'operator =' function is unavailable"
So this is where I am stuck... I cannot obtain a hDC from a PictureBox.