D
Dinu Chandran
Guest
Hi,
We have an application window which is developed under VC++ to display some information’s like text and some numbers.
This window can be resized and moved to some locations on the screen.
We had a situation in one of our production line that, this window sometimes only display a few part of it. Say, the top half portion only.
We had a research on this situation and we have done so many reproduction and finally we came to know that, the problem occurs in Window10 LTSB environment. Not in LTSC environment.
We have checked the messages which are received in both environment using WinSpy and it is same on both cases.
The height of the window is checked using WinSpy and it is big.
Say, if the height of the window is 100pixel. The DC draws only some portion. Say 20pixel.
One point is that, the whole drawing of this window is done in OnEraseBkgnd.
We are planning to move the whole drawing to OnPaint(), but, we have a situation to identify the cause before changing the production line.
It would be very thankful if you can help us on finding the root cause of this issue.
Can it be a known issue of LTSB environment ?
BOOL InfoDisplayWindow::OnEraseBkgnd(CDC* pDC)
{
CBitmap m_bitmap; // Offscreen bitmap
CBitmap* m_oldBitmap; // bitmap originally found
CRect m_rect; // Rectangle of drawing area.
HDC hDC = CreateCompatibleDC(pDC->m_hDC);
CDC* pTmpDC = CDC::FromHandle(hDC);
pDC->GetClipBox(&m_rect);
m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
m_oldBitmap = pTmpDC->SelectObject(&m_bitmap);
pTmpDC->SetWindowOrg(m_rect.left, m_rect.top);
CRect rc;
GetClientRect(&rc);
pTmpDC->FillSolidRect(&rc, COLOR_KEY); // Black color
DrawFunction();// Text is displayed in this function
CPen pen(PS_SOLID, SOLID_BORDER_WIDTH, BORDER_COLOR);
CPen *old_pen = pTmpDC->SelectObject(&pen);
// Drawing the 4 boarders of the window using red line.
pTmpDC->MoveTo(rc.left, rc.bottom - 1);
pTmpDC->LineTo(rc.left, rc.top);
pTmpDC->LineTo(rc.right - 1, rc.top);
pTmpDC->LineTo(rc.right - 1, rc.bottom - 1);
pTmpDC->LineTo(rc.left, rc.bottom - 1);
pTmpDC->SelectObject(old_pen);
// Copy the offscreen bitmap onto the screen.
pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
pTmpDC, m_rect.left, m_rect.top, SRCCOPY);
//Swap back the original bitmap.
pTmpDC->SelectObject(m_oldBitmap);
return TRUE;
}
Continue reading...
We have an application window which is developed under VC++ to display some information’s like text and some numbers.
This window can be resized and moved to some locations on the screen.
We had a situation in one of our production line that, this window sometimes only display a few part of it. Say, the top half portion only.
We had a research on this situation and we have done so many reproduction and finally we came to know that, the problem occurs in Window10 LTSB environment. Not in LTSC environment.
We have checked the messages which are received in both environment using WinSpy and it is same on both cases.
The height of the window is checked using WinSpy and it is big.
Say, if the height of the window is 100pixel. The DC draws only some portion. Say 20pixel.
One point is that, the whole drawing of this window is done in OnEraseBkgnd.
We are planning to move the whole drawing to OnPaint(), but, we have a situation to identify the cause before changing the production line.
It would be very thankful if you can help us on finding the root cause of this issue.
Can it be a known issue of LTSB environment ?
BOOL InfoDisplayWindow::OnEraseBkgnd(CDC* pDC)
{
CBitmap m_bitmap; // Offscreen bitmap
CBitmap* m_oldBitmap; // bitmap originally found
CRect m_rect; // Rectangle of drawing area.
HDC hDC = CreateCompatibleDC(pDC->m_hDC);
CDC* pTmpDC = CDC::FromHandle(hDC);
pDC->GetClipBox(&m_rect);
m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
m_oldBitmap = pTmpDC->SelectObject(&m_bitmap);
pTmpDC->SetWindowOrg(m_rect.left, m_rect.top);
CRect rc;
GetClientRect(&rc);
pTmpDC->FillSolidRect(&rc, COLOR_KEY); // Black color
DrawFunction();// Text is displayed in this function
CPen pen(PS_SOLID, SOLID_BORDER_WIDTH, BORDER_COLOR);
CPen *old_pen = pTmpDC->SelectObject(&pen);
// Drawing the 4 boarders of the window using red line.
pTmpDC->MoveTo(rc.left, rc.bottom - 1);
pTmpDC->LineTo(rc.left, rc.top);
pTmpDC->LineTo(rc.right - 1, rc.top);
pTmpDC->LineTo(rc.right - 1, rc.bottom - 1);
pTmpDC->LineTo(rc.left, rc.bottom - 1);
pTmpDC->SelectObject(old_pen);
// Copy the offscreen bitmap onto the screen.
pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
pTmpDC, m_rect.left, m_rect.top, SRCCOPY);
//Swap back the original bitmap.
pTmpDC->SelectObject(m_oldBitmap);
return TRUE;
}
Continue reading...