阅读以下代码: 为什么 m_dcMem.BitBlt(0,0,m_size.cx,m_size.cy,& dcScreen,0,0,SRCCOPY); 有效, 和 dcScreen.BitBlt(0,0,m_size.cx,m_size.cy,& m_dcMem,0,0,SRCCOPY); 不要? 谢谢! `
int CScreenDlg :: OnCreate(LPCREATESTRUCT lpCreateStruct)
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
ShowWindow(SW_HIDE);
CDC dcScreen;
dcScreen.CreateDC("DISPLAY", NULL, NULL, NULL);
//dcScreen.Attach(GetDC(GetParent()));
m_size.cx = GetDeviceCaps(dcScreen.GetSafeHdc(), HORZRES);
m_size.cy = GetDeviceCaps(dcScreen.GetSafeHdc(), VERTRES);
m_dcMem.CreateCompatibleDC(&dcScreen);
m_bmpScreen.CreateCompatibleBitmap(&dcScreen, m_size.cx,m_size.cy);
CBitmap* pOldBmp = m_dcMem.SelectObject(&m_bmpScreen);
//m_dcMem.BitBlt(0,0,m_size.cx, m_size.cy, &dcScreen, 0,0, SRCCOPY);
dcScreen.BitBlt(0,0,m_size.cx, m_size.cy, &m_dcMem, 0,0, SRCCOPY); //why it doesn't work???
CRect rect(0,0,m_size.cx, m_size.cy);
LEFT_RECT = CRect(INFO_OFFSET, INFO_OFFSET, INFO_OFFSET + INFO_WIDTH, INFO_OFFSET + INFO_HEIGHT);
RIGHT_RECT = CRect(m_size.cx - INFO_WIDTH-INFO_OFFSET, INFO_OFFSET, m_size.cx-INFO_OFFSET, INFO_OFFSET + INFO_HEIGHT);
m_rectInfo = LEFT_RECT;
m_bmpInfoBK.LoadBitmap(IDB_BITMAP_INFOBK);
MoveWindow(rect);
ShowWindow(SW_SHOW);
m_hCursor = LoadCursor(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDC_CURSOR_SELECT));
return 0;
}