There are a number of different types of dialog boxes and some different ways of creating them, mostly using
resource scripts which are compiled into object form prior to linkage into the final executable. These
resource scripts provide a convenient mechanism for including dialogs and other 'resources' into an application
without cluttering the source code itself with arguably unwieldy complications.
There are essentially two types of dialogs namely modal dialogs which, when active, tend to be
topmost within an application and don't permit other user input within the application until they have been
dealt with and dismissed, and modeless dialogs which act more or less like normal windows with
regard to focus and their position in the z-order.
Dialog boxes are windows, usually system defined with a system class name of #32770, but may also
have application defined class names in the case of 'window' dialogs.
The following examples are described:
Dialogs usually contain controls which are defined within the resource script using resource definition statements either with control
specific resource definition statements or, generally with the CONTROL resource definition statement. Note that
while it is possible to create richedit controls via a resource script, in practice this is not such a good idea. This is because the type of
richedit control can only be determined at runtime and not at compile time when the resource object is created from the corresponding script.
Of course, if a richedit v1.0 is all that is required then this can be safely defined within the resource script. The following examples of control
creation are described:
This is an example of what is sometimes referred to as a 'formview' dialog. The dialog(the 'form'), either modal or modeless,
is created as a borderless child of a normally registered and created window. This enables gui design of control layout to be
relegated to a resource script.
Memory dialogs are the reason resource scripts were invented. Probably. They are, quite simply, horrible and should, in my opinion anyway, be avoided which is
easily done since there are so many simpler ways to create dialogs. Since such dialogs are created from memory templates there is no actual dialog
resource section in the executable; accordingly the dialog template cannot be extracted using tools that can extract resources from other programs. This
example is only included for completeness.
Modal dialogs are usually handy but sometimes annoying windows that exist to get some user input. Their default behavior - modality - is to become
the active, topmost window within an application until they are dismissed.
Modeless dialogs behave very much like normal windows in that switching between them and other windows within the same application can normally take place.
A 'window' dialog is an application registered and created window based on a dialog resource defined in a resource script.
This example defines a modal dialog and fills it with the various user controls (excluding richedit) for which specific resource definition statements exist.
This example defines a modal dialog and fills it with the various common controls (excluding tooltip) using the CONTROL
resource definition statement because no individual resource defintion statements exist for the common controls. The example uses much of the
initialisation code from the 'Creating Common Controls' section.