Device Context Problem in XP

M

Mullai

Hi Frendz,

I am working in an application in VC++ 6.0 in Windows 98
platform for drawing images.It works well in win 98 . I am trying to
import the same application for Windows XP. While doing this the DEVICE
CONTEXT creates problem.

///////////////////MY CODE//////////////

int CPicture::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
CPaintDC dc(this);
CRect clientRect;

CPageWindow *page=(CPageWindow *)GetParent();

if(page)
{
clientRect.SetRect(0,0,page->Width,-page->Height);
int oldmapmode=dc.SetMapMode(MM_HIENGLISH);
dc.LPtoDP(&clientRect);
dc.SetMapMode(oldmapmode);
}

m_memDC=new CDC();
m_memBitmap=new CBitmap();
m_memDC->CreateCompatibleDC(&dc);
m_memBitmap->CreateCompatibleBitmap(&dc,clientRect.Width(),clientRect.Height());
m_pOldMemBitmap=m_memDC->SelectObject(m_memBitmap);
return 0;
}
/////////////////////////// end of code/////////////

My problem is after converting from LPtoDP the client rect value is
top=0 bottom=1680 left=0 right= 1054 clientrect(0 1680 0 1054)

in Windows 98 the LPtoDP the client rect value is ient rect value is
top=0 bottom=1984 left=0 right= 1245 clientrect(0 1984 0 1245)


because of this change in the dc the picture position changes..... Can
u pl help how to make the DC compatible for windows xp from wimdows 98


Thanx in advance
Mulls
 
R

raylopez99

My problem is after converting from LPtoDP the client rect value is
top=0 bottom=1680 left=0 right= 1054 clientrect(0 1680 0 1054)

in Windows 98 the LPtoDP the client rect value is ient rect value is
top=0 bottom=1984 left=0 right= 1245 clientrect(0 1984 0 1245)


because of this change in the dc the picture position changes..... Can
u pl help how to make the DC compatible for windows xp from wimdows 98

I think you have identified the problem. So what remains?

BTW, in the future you might want to switch to Forms rather than MFC
library.

RL
 
B

Ben Voigt

My problem is after converting from LPtoDP the client rect value is
top=0 bottom=1680 left=0 right= 1054 clientrect(0 1680 0 1054)

in Windows 98 the LPtoDP the client rect value is ient rect value is
top=0 bottom=1984 left=0 right= 1245 clientrect(0 1984 0 1245)


because of this change in the dc the picture position changes..... Can
u pl help how to make the DC compatible for windows xp from wimdows 98

If you want the exact same sizes in pixels, don't use HIENGLISH. Windows is
doing exactly what you asked it to do, namely adjusting for the screen
pitch, which are commonly specified at 96dpi or 120 dpi, but can be affected
by the manufacturer's monitor driver.
 
M

Mullai

HI,

Only in MM_HIENGLISH K am importing the Pictures in the page for
the newspaper. Pl let me know how to overcome this map mode problem.
 
D

David Wilkinson

Mullai said:
Hi Frendz,

I am working in an application in VC++ 6.0 in Windows 98
platform for drawing images.It works well in win 98 . I am trying to
import the same application for Windows XP. While doing this the DEVICE
CONTEXT creates problem.

Mullai:

Please don't multi-post. You have asked this question in the MFC group also.

David Wilkinson
 
Top