Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 1.28 KB

creating-an-error-callback-function.md

File metadata and controls

59 lines (38 loc) · 1.28 KB
title description ms.assetid keywords ms.topic ms.date
Creating an Error Callback Function
Creating an Error Callback Function
a489ec94-c566-44b1-aa93-9b43f23de744
capSetCallbackOnError macro
article
05/31/2018

Creating an Error Callback Function

The following example is a simple error callback function. Register this callback by using the capSetCallbackOnError macro.

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; 
} 

Related topics

Using Video Capture