Главная страница | назад





Article #16659: Dialog boxes at Runtime with Win95 controls

 Question and Answer Database
FAQ1659C.txt Dialog boxes at Runtime with Win95 controls
Category :Windows API
Platform :All
Product :BC++ 5.x
Question:
I am producing an Windows'95 application which uses a large number
of similar, but not identical, dialog boxes. Rather than
producing a resource for each box it seems reasonable to create
the dialog boxes at run time, when I know exactly what controls
I need.
I have managed to achieve this by creating a popup window, with
its own window function, and disableling the parent, and adding
the controls I need by using CreateWindow() with the types
button, static, etc.
This all works fine, but the font these controls use is not the
same as the one used by dialog boxes created with the resource
workshop. Its only a small complaint, but it does rather spoil
the effect of the dialog boxes, they look like something from
Windows 3.xx rather than Win'95. So, is it possible to set the
font the controls created by CreateWindow() use? Or, is there
a better way of creating dialog boxes at runtime altogether?
Answer:
You could create the standard dialog font using CreateFont and
send a WM_SETFONT message to the controls. Alternatively, you
could derive a subclass from the standard controls and let them
set a WM_SETFONT message to themselves.
5/18/98 8:55:57 AM

Last Modified: 01-SEP-99