> > > > Hi guys,
> > > > I've been mucking around in the guts of the Dialog box resources
> > trying
> > > > to replicate, for fun, dialog boxes like Windows does. The
> > thing
> > > > is that even with all the documentation of how it is supposed
> > it,
> > > > it doesn't come out the same.
> > > > For example, I have a window that in the dialog box resource
> > > > 112 x 186. So, I create the window using x = 0, y = 0, cx = 112
> > > > (chrWidth / 4.0), cy = 186 * (chrHeight / 8.0). Well, it is
> > but
> > > > no CEE-gar. (I am comparing it with a dialog box that pops up
> > > > same time).
> > > > So what is the deal? Is there some "special math" going on? Does
> > anyone
> > > > know?
> > > What are "chrWidth" & "chrHeight". Did you look them up
> > > using GetDialogBaseUnits()?
> > > I think there may be additional scaling for the font specified
> > > (or not) for the dialog box. If your dialog box resource
> > > have a FONT statement, then it should be correct, if you
> > > use GetDialogBaseUnits(). Otherwise, there may be a
> > > factor that depends on the relative widths of SYSTEM_FONT
> > > and the specified FONT.
> > No, I was using GetTextMetrics. See there ISN'T a dialog box, I am
> > merely using the resource data to create a window to LOOK like a
> > box (why? because there isn't a WYSISYG editor for MDI windows).
> > am trying to figure out is HOW windows is creating the dialog
> > box "window" based on the font. The documentation is light in this
> > and, from my messing abouts, doesn't seem to be correct.
> There doesn't have to be any dialog box to use
> GetDialogBaseUnits() - it's a system "metric".
> Call that function and use the values it returns instead of
> the ones you're getting from GetTextMetric(). See if it
> makes a difference.
> Did you create the required HFONT? Did you remember
> to select your font into the HDC before GetTextMetric()?
1) You're correct about GetDialogBaseUnits, however what it returns is
virtually useless as the dialog box that is created is based on the
font size. GetDialogBaseUnits seems to be 16 and 8 (y and x
respectively). Been there, done that, don't work.
2) I would have asked the same question, not knowing the skill level of
the person asking the question. Unfortunately, I have been writing
Windows code professionally since 3.x. So, it's not really a newbie
So, of course, my next step was take the dependencies out and
manipulate the variables using the following formulas (the ones MS says
windowWidth = dialogWidth * (chrWidth / 4.0);
windowHeight = dialogHeight * (chrHeight / 8.0);
Now, using the values for the dialog box (my example is 112 for dialog
width, 186 for dialog Height) and mess around with the chrWidth and
chrHeight variables you CAN NOT get a window that is the same size as
the dialog box.
ERGO, Microsoft must be using something completely different than
documented. That is the information I am trying to gather.
Sent via Deja.com http://www.deja.com/
Before you buy.