473,465 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Device Context Problem in XP

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(),cli entRect.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

Dec 30 '06 #1
5 1423
>
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

Dec 30 '06 #2
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.
>
Thanx in advance
Mulls

Jan 1 '07 #3
Hi,
I have identified the problem. But how to solve the Map mode
problem?
raylopez99 wrote:

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
Jan 23 '07 #4
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.

Ben Voigt wrote:
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.

Thanx in advance
Mulls
Jan 23 '07 #5
Mullai wrote:
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
Jan 23 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Abd | last post by:
Hiiiiiii I am programming in Visual C++ 6.0 I want to get RGB percent of all of pixls of screen, and so I need to get Device Context of entire screen. I know that CClientDC dc(this) gets a divice...
0
by: Rahul | last post by:
Hi All, We are invoking a method exposed by thrid party DLL (Non COM), the method expects one of the parameter as handle to device context of vb.net form. As form object is changed in .Net, we...
1
by: Ben Taylor | last post by:
Hi Does anybody have any code examples of using C# to draw to a window using device contexts, more specifically, erasing the entire window by painting a background color in the OnPaint / OnDraw...
0
by: sandy_pt_in | last post by:
I am very new to C#... i have one VC++ dll using that i have to display video frames in picture box but VC++ dll function asking device context... how can I get device context of picture box as i...
1
by: Dennis | last post by:
I'm using VS 2003 my project uses COM interop and the Tao Framework. I have a custom control derived from UserControl. It implements many functions similar to the Tao's SimpleOpenGLControl, for...
0
by: Jigar Mehta | last post by:
Hye Friends.. Jigar Mehta from India.. Currently I want to load one BMP and show it onto device context.. So, has anyone done the thing? I have loaded the Image by CBitmap, but how to get it in...
13
by: Metallicraft | last post by:
I have a vb6 application. On the main form is a picture box with one or two images and several pieces of text displayed in it. These are created on the fly using gdi32 routines that are all in a...
8
by: Joergen Bech | last post by:
Suppose I have Dim bm As New Bitmap(16, 16,Imaging.PixelFormat.Format8bppIndexed) I cannot use Dim g As Graphics = Graphics.FromImage(bmdest) Dim hdc As IntPtr = g.GetHdc() as the...
0
by: =?Utf-8?B?bmNvbG9zaQ==?= | last post by:
Is it possible to render a winform directly to a memory device context instead of rendering to a display device context ?
6
by: =?Utf-8?B?bmNvbG9zaQ==?= | last post by:
Is it possible to render a winform directly to a memory device context instead of rendering to a display device context ?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.