Creating the Options Template

Similar to the address entry template, you need to provide templates into which the user can enter message and recipient options. The Microsoft Exchange Server SDK provides the TEMPLATE.EXE utility, which converts a text file describing dialog box controls into a binary file. You can use TEMPLATE.EXE to compile both your address entry templates and your options templates.

The TEMPLATE.EXE utility accepts a Unicode comma-separated-value (CSV) file of template control fields. The field descriptions are based on parameter definitions in the MAPI Programmer’s Reference. The actual field contents will vary depending on the syntax of the control, and a given field might not exist for a given control.

Options templates are created from .WTX files that you can create with the NOTEPAD.EXE utility. Each line in the file has 10 fields which describe one element in the options template. The following table lists the fields for describing these elements.

Control Fields for Options Templates

Field Type Description
1 Integer Horizontal position of control.
2 Integer Width of control.
3 Integer Vertical position of control.
4 Integer Height of control.
5 Integer Type of control. Valid entries are:
DTCT_BUTTON – Creates a command button.
DTCT_CHECKBOX – Creates a check box.
DTCT_EDIT – Creates an edit field for user input.
DTCT_GROUPBOX – Creates a group box.
DTCT_LABEL – Creates a text label.
DTCT_LBX – Creates a list box.
DTCT_MVLISTBOX – Creates a multivalued list box.
DTCT_PAGE – Introduces a new page in the property sheet.
6 Integer Control flags. This field corresponds to the ulFlags parameter in the MAPI structures.

Valid entries can be a combination of the following:
0x00000001 – Creates a multiline edit control.
0x00000002 – Allows edit control to be edited.
0x00000004 – Requires data from the user upon OK.
0x00000010 – Displays an asterisk (*) as user types in the edit control, such as for a password.

These flags are used only for DTCT_EDIT entries. To combine these flags, bitwise OR them and enter the result in this field.

DTCT_PAGE entries make special use of this field. Rather than storing flags, this field is used to store the context identifier of the topic in the help file for this property sheet.

7 Integer Control parameter 1. For DTCT_EDIT fields, this is the maximum length of input.
8 Integer Control parameter 2. This field is the property tag that controls are mapped to. It corresponds to the ulPropTag parameter in the MAPI structures.
9 Integer Control parameter 3. This is an extra field for the DTCT_LBX control.
10 Text Text label for DTCT_LABEL controls. For DTCT_EDIT controls this field holds the input mask. See the MAPI Programmer’s Reference for valid input masks.

Address Entry Template Binary Data shows an example of a Unicode text file for an address entry template. You can create a similar file to produce an options template. To compile an options template, call TEMPLATE.EXE with the “–M” flag, as shown in the following command.

TEMPLATE -M sourcefile destfile

where sourcefile is the Unicode file (usually with extension .WTX) and destfile is the file that will contain the compiled template.