Honeywell 5180 Frozen Dessert Maker User Manual


 
6 - 3
}
else
{
hhpGetErrorMessage( nResult,tcErrMsg );
_tprintf( _T(“Capture Barcode Returned: %s\n”),tcErrMsg );
}
Sample 5 - An asynchronous barcode capture message notification
Note: You must hook the message WM_HHP_EVENT_HWND_MSG in your message loop to receive a barcode event
notification. In this example, the message is hooked to call OnEventMsg.
TCHAR tcErrMsg[ 128 ]; // Error message buffer.
Result_t nResult = RESULT_ERR_INTIALIZE; // Return code.
HWND hWnd = GetSafeHwnd(); // The window to which message is to be
sent. (note: this example is MFC c++)
// Register the message window with the SDK.
if ( (nResult = hhpSetAsyncMethods( NULL,hWnd,NULL ) == RESULT_SUCCESS )
{
// Call the SDK function to capture a barcode, 6 second timeout. Unless call fails, you
will get a message when command completes.
if ( (nResult = hhpCaptureBarcode( NULL,6000,FALSE ) != RESULT_SUCCESS )
{
hhpGetErrorMessage( nResult,tcErrMsg );
_tprintf( _T(“Capture Barcode Returned: %s\n”),tcErrMsg );
}
}
// Message Handler function
LRESULT OnEventMsg( WPARAM wParam,LPARAM lParam )
{
hhpEventTye_t eventType = (hhpEventType_t)wParam; // Event type
DWORD dwBytes = lParam; // Number of bytes in barcode.
You don’t actually use it
here.
HHP_DECODE_MSG decodeInfo; // Decode message structure.
TCHAR tcErrMsg[ 128 ]; // Error message buffer.
Result_t nResult = RESULT_ERR_INTIALIZE; // Return code.
// Verify the event type is barcode
if( eventType == HHP_BARCODE_EVENT )
{
// Make sure to set the structure size!
decodeInfo.dwStructSize = sizeof( HHP_DECODE_MSG );
if( (nResult = hhpGetAsyncResult( &eventType,&decodeInfo )) == RESULT_SUCCESS )
{
_tprintf( _T(“Barcode: %s\n”),decodeInfo.pchMessage );
_tprintf( _T(“Barcode Length: %d\n”),decodeInfo.nLength );
_tprintf( _T(“AIM Id : %cn”),decodeInfo.chCodeID );
_tprintf( _T(“HHP Id: %cn”),decodeInfo.chSymLetter );
_tprintf( _T(“Symbol Modifier: %c\n”),decodeInfo.chSymModifier );
}
else
{
hhpGetErrorMessage( nResult,tcErrMsg );
_tprintf( _T(“Capture Barcode Returned: %s\n”),tcErrMsg );
}
}
}