In addition to indicating the fields used in a data structure, flags can indicate an option that does not use any parameters. For example, the MCI_WAIT flag does not use any parameters.

When you add new flags, you must make sure that they do not conflict with the flags already in use. Bits 0 through 15 of the 32-bit ULONG are reserved for MDM. Bit 16 (0x00010000) is the first fit that a driver can use for its flags. If your command message is a new command message, you must choose bit positions that do not conflict with the flags already defined for that command. Any unused bits in the new flag must be set to zero. For example, if a new command for videodisc players uses flags 16 through 20, a custom extension to the new command could use flags 21 through 31.

To continue the example for adding a RESET command to a videodisc driver, the code sample shown in the following example defines a data structure, a corresponding pointer for it, and the flag corresponding to the program field of the data structure.

typedef struct {
  HWND   hwndCallback;
  ULONG  ulProgram;
} MCI_VD_RESET_PARMS;

typedef MCI_VD_RESET_PARMS FAR * PMCI_VD_RESET_PARMS;

#define MCI_VD_RESET_PROGRAM     0x00010000L

When the application sets the MCI_VD_RESET_PROGRAM flag in ulParam1, it indicates that a value is assigned in the ulProgram field.

Now that you have created the message command, data structure, and flags, you need to create the command table that tells MDM how to translate the equivalent string command into the message command format. See Parsing a Command List.


[Back] [Next]