Création d’une fonction de rappel d’erreur
L’exemple suivant est une fonction de rappel d’erreur simple. Inscrivez ce rappel à l’aide de la macro capSetCallbackOnError .
TCHAR gachBuffer[100]; // Global buffer.
// ErrorCallbackProc: error callback function.
// hWnd: capture window handle.
// nErrID: error code for the encountered error.
// lpErrorText: error text string for the encountered error.
//
LRESULT PASCAL ErrorCallbackProc(HWND hWnd, int nErrID,
LPTSTR lpErrorText)
{
if (!hWnd)
return FALSE;
if (nErrID == 0) // Starting a new major function.
return TRUE; // Clear out old errors.
// Show the error identifier and text.
_stprintf_s(gachBuffer, TEXT("Error# %d"), nErrID);
MessageBox(hWnd, lpErrorText, gachBuffer,
MB_OK | MB_ICONEXCLAMATION);
return (LRESULT) TRUE;
}
Rubriques connexes
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour