The following code illustrates how to obtain the description of a given error code.

    #define ILLEGAL_COMMAND  (USHORT) 0x0000FFFF /* Illegal command   */
    #define MCI_ERROR_STRING_LENGTH  128         /* Length of error
                                                    message buffer    */

    CHAR acErrorStringBuffer[MCI_ERROR_STRING_LENGTH];
    ULONG ulRC;

    ulRC =
      mciSendCommand(
         0,                           /* Don't know the device yet     */
         ILLEGAL_COMMAND,             /* Command to be performed       */
         MCI_WAIT,                    /* Flags for the command         */
         (ULONG) NULL,                /* No parameter list             */
         0 );                         /* No notify message             */

    if ( ulRC != MCIERR_SUCCESS)
     {
      ulRC =
       mciGetErrorString(
         ulRC,
         (PSZ) acErrorStringBuffer,         /* acErrorStringBuffer     */
         (USHORT) MCI_ERROR_STRING_LENGTH );/* should = "unrecognized
                                               command"                */
     }


[Back] [Next]