Error Messages and Notifications

MCIWnd uses MCI to control the devices that play and record multimedia data. In general, MCIWnd displays MCI errors in an error dialog box. An MCI error is generated whenever an MCI command fails. For example, if your application tries to resume paused playback by using the MCIWndResume macro and the current device does not support resume, an error is reported to the user.

MCIWnd allows you two choices for handling error messages:

  • You can prevent error messages from reaching the user. To prevent the display of MCI error messages, specify the MCIWNDF_NOERRORDLG window style when you create an instance of an MCIWnd window by using the MCIWndCreate or CreateWindowEx function.
  • You can redirect them to your application for display. To redirect MCI error messages to your application, specify the MCIWNDF_NOTIFYERROR window style when you create an instance of an MCIWnd window by using MCIWndCreate or CreateWindowEx.

When error notification is enabled, MCIWnd sends each notification message (MCIWNDM_NOTIFYERROR) to the main message handler of the parent of the MCIWnd window. Your application must have a message handler to process the notification messages it receives.

You can obtain a textual description of the most recent MCI error message by using the MCIWndGetError macro. This macro returns the text in an application-defined buffer. If the error string is longer than the buffer, MCIWnd truncates the string.

You can route all notifications to another window by using the MCIWndSetOwner macro.