Well, thanks for the input. This is not design critical, I was just
wondering how feasible it was.
"Joseph M. Newcomer" wrote:
Generally, you can be absolutely certain that when you write numbers like 750 and 850, you
have built a program that will run on exactly ONE computer, the one you are using for
development, given the current settings of screen resolution, screen size, graphics card,
graphics device driver, and default user font. And probably a few other things, such as
the angular position of Mars with respect to Jupiter.
In this case, if it is the mainframe, the units you are expressing ARE device units. If
they don't produce the result you want, it is probably because they are the wrong values.
On a good day, if the driver and the monitor are in communication, and not lying to each
other, and you have offered the right sacrifices to the right gods of programming (burnt
punched cards are common), you just MIGHT find out that the ::GetSystemMetrics calls will
give you information that might actually be trustable. You might also find that the
CDC::GetDeviceCaps values might actually be trustable. But I wouldn't predicate the
success of a product on any of these variables. Overall, any attempt to make screen
images fit into actual inches or millimeters or whatever is more by luck than by design.
The precisely right device driver with the precisely right monitor might do the job, but
there will be a lot of machines for which this will simply not be possible.
Part of it depends on context; you will more likely have good luck if you are on a tablet
machine than a non-tablet machine.
joe
On Thu, 29 Mar 2007 07:48:05 -0700, Mkennedy1102 <Mkennedy1102@discussions.microsoft.com>
wrote:
I can change the size of my mainframe with the PreCreateWindow() function by
setting the attributes of the CREATESTRUCT; I.E...
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.cx = 750;
cs.cy = 850;
return TRUE;
}
however, the size I set it to is in logical units. Is there a way to
convert the sizes to device units? In other words I want the window to be x
inches by y inches on the monitor. How can I programatically redefine the
hieght and width to do this? It wouldnt help me to determine the ratio for my
own display setup, I need a way to determine it at runtime. I don't know if
LPtoDP will work, since there doen't seem to be a device context involved
here...
Any help would be appreciated, thanks in advance.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm