![background image](http://html1.mh-extra.com/html/hand-held-products/5080/5080_user-manual_589690058.webp)
6 - 6
5X80 Series Software Development Kit (SDK) User’s Guide
_tprintf( _T(“Image Capture Failed: %s\n”),tcErrMsg );
}
// Remember to delete your buffer.
delete [ ] image.puchBuffer;
Sample 8 - An asynchronous image capture using Windows Messaging
Note: You must hook the message WM_HHP_PROGRESS_HWND_MSG in your message loop to receive a barcode event
notification. Here, assume the message is hooked to call OnEventMsg.
// Capture image specifies:
for capture - none (use imager config settings)
for transfer - subsample value of 2 and JPEG transfer, progress notification
HHP_IMAGE_TRANSFER
imgTrans;
// Image transfer options (override
imager config)
TCHAR
tcErrMsg[ 128 ];
// Error message buffer.
Result_t
nResult = RESULT_ERR_INTIALIZE;
// Return code.
extern DWORD
g_dwPercentComplete = NULL;
// Percent complete updated by SDK.
// Make sure to set imgTrans structure size!
imgTrans.dwStructSize = sizeof( HHP_IMAGE_TRANSFER );
// Set the subsample, compression, and, since you’re specifying lossy compression (JPEG),
add the compression factor masks. You are also asking to receive both a Windows message
with progress information, as well as having the SDK update a DWORD with the percentage
of transfer completion. For the latter, it is important the DWORD not lose scope or be
deleted before the asynchronous call completes. You might have a thread or timer that
looks at this value periodically before altering the user.
ImgTrans.dwMask =( SUBSAMPLE_VALUE_MASK | COMPRESSION_MODE_MASK | COMPRESSION_FACTOR_MASK
| TRANSFER_UPDATE_HWND | TRANSFER_UPDATE_DWORD);
// Set values
imgTrans.dwSubSample = 2;
// Every other pixel and every other
row.
imgTrans.compressionMode = COMPRESSION_LOSSY;
// Image compression lossy which is
mode 1 JPEG lossy.
imgTrans.compressionFactor = 95;
// Image compression factor (image
quality) of 95%.
ImgTrans. hTransferNotifyHwnd = GetSafeHwnd();
// Set this to the window handle you
wish to receive the progress
message.
imgTrans.dwPercentComplete = &g_dwPercentComplete;//Tell SDK to update this DWORD as data
is received.
// Call the SDK function to capture an image setting the bWait parameter to FALSE for
asynchronous behavior.
if ( (nResult = hhpAcquireImage( NULL,&imgTrans,NULL,FALSE ) == RESULT_SUCCESS )
{
// Display the image. NOTE: You could specify FF_BMP_GRAY. The data would come
as a BMP file.
}
else
{
hhpGetErrorMessage( nResult,tcErrMsg );
_tprintf( _T(“Image Capture Failed: %s\n”),tcErrMsg );
}
// Message Handler for transfer progress message
Содержание 5080
Страница 1: ...Software Development Kit SDK for 5080 5180 and 5380 Decoded Miniature Image Scan Engines User s Guide ...
Страница 6: ...iv 5X80 Series Software Development Kit SDK User s Guide ...
Страница 14: ...1 8 5X80 Series Software Development Kit SDK User s Guide ...
Страница 50: ...4 14 5X80 Series Software Development Kit SDK User s Guide ...
Страница 60: ...6 8 5X80 Series Software Development Kit SDK User s Guide ...
Страница 62: ...7 2 5X80 Series Software Development Kit SDK User s Guide ...
Страница 63: ......
Страница 64: ... Hand Held Products Inc 700 Visions Drive P O Box 208 Skaneateles Falls NY 13153 0208 5X10 80SDK UG Rev C 9 07 ...