INF: Adding Custom Error Strings to an MCI Device Driver

ID Number: Q76411

1.00

WINDOWS

Summary:

In the Microsoft Multimedia Windows graphical environment, an

application can use the mciGetErrorString function to obtain the

string associated with an error code returned from a Media Control

Interface (MCI) device driver.

An MCI driver can use a STRINGTABLE resource to store its error

strings. The identifier constant for each string should correspond to

the error value returned by the DriverProc function. This value must

be greater than or equal to the constant MCIERR_CUSTOM_DRIVER_BASE to

avoid confusion with the predefined MCI error codes.

More Information:

For example, the Pioneer LaserDisc device driver, MCIPIONR.DRV,

included with the Microsoft Multimedia Device Development Kit (MDDK),

contains the following declarations in its header file, MCIPIONR.H:

#define MCIERR_PIONEER_ILLEGAL_FOR_CLV (MCIERR_CUSTOM_DRIVER_BASE)

#define MCIERR_PIONEER_NOT_SPINNING (MCIERR_CUSTOM_DRIVER_BASE+1)

#define MCIERR_PIONEER_NO_CHAPTERS (MCIERR_CUSTOM_DRIVER_BASE+2)

#define MCIERR_PIONEER_NO_TIMERS (MCIERR_CUSTOM_DRIVER_BASE+3)

Its resource file, MCIPIONR.RC, contains the following STRINGTABLE

definition:

STRINGTABLE

BEGIN

MCIERR_PIONEER_ILLEGAL_FOR_CLV, "Illegal operation for CLV \

type disc."

MCIERR_PIONEER_NOT_SPINNING, "The disc must be spun up to perform \

this operation."

MCIERR_PIONEER_NO_CHAPTERS, "Chapters are not supported for this \

disc."

MCIERR_PIONEER_NO_TIMERS, "All timers are in use. Cannot enable \

notification."

END

When the mciGetErrorString function receives a value greater than or

equal to MCIERR_CUSTOM_DRIVER_BASE, it looks in the driver's resource

table for a string with the corresponding identifier.

Additional reference words: 1.00