Most Movie Player functions return a FALSE or NULL value to indicate errors. Use the mmpError function to obtain a specific error code and error message. The syntax of this function is as follows:
int mmpError(idMovie, lpszError, wLen)
Pass the movie ID to the idMovie parameter. To return the last Movie Player error occurring with any instance, pass a NULL value to the idMovie parameter.
To get an error message string, pass a far pointer to a character buffer to the lpszError parameter. The wLen parameter indicates the maximum number of characters to copy to the lpszError buffer. The MMP_MAXERRORLENGTH constant specifies the maximum length of Movie Player error strings. You can pass a NULL pointer to the lpszError parameter to obtain only the numeric error code returned by the function.
Error-code values returned by mmpError are defined in the MMP.H header file. For more information on error return codes, see the description of mmpError in the Programmer's Reference.
The following function is used in many of the code samples in this chapter. It calls mmpGetError to get a detailed error message and displays the error message in a message box.
void PrintError(MMPID idMovie, LPSTR lpszIntro)
{
char szErrorBuf[MMP_MAXERRORLENGTH];
mmpError(idMovie, szErrorBuf, MMP_MAXERRORLENGTH);
MessageBeep(MB_ICONEXCLAMATION);
MessageBox(hFullWnd ? hFullWnd : hMainWnd, szErrorBuf, lpszIntro,
MB_OK | MB_ICONEXCLAMATION);
}