Automating Playback

You can automate playback in your application by using MCIWndCreate_T_JCT and the MCIWndPlay18EVXWH macro, along with either the MCIWndDestroy.58KM6 or the MCIWndCloseGB21LI macro. To automate playback, specify the MCIWNDF_NOPLAYBAR and MCIWNDF_NOTIFYMODE styles in the MCIWndCreate dwStyle parameter. Specify the MCIWNDF_NOPLAYBAR style to hide the toolbar, and the MCIWNDF_NOTIFYMODE style to issue an appropriate notification message when the device stops playing.

You can play the device or file specified in MCIWndCreate by using MCIWndPlay. The MCIWndPlay macro starts playing the content from its current playback position and continues to its end.

You can destroy or close an MCIWnd window by using the MCIWndDestroy.58KM6 or MCIWndCloseGB21LI macro. The MCIWndDestroy macro closes the device or file and destroys the MCIWnd window by invalidating its handle. If your application can reuse the MCIWnd window, use MCIWndClose to close the device without destroying the window.

Your application can detect when the device stops playing and automatically close the window. To do this, specify the MCIWNDF_NOTIFYMODE style for the dwStyle parameter of MCIWndCreate_T_JCT. This causes the device to send a MCIWNDM_NOTIFYMODE199B3OV message whenever it changes modes. Your application can trap this message to determine whether the device has stopped playing. When the device stops playing, the application closes the window.