dev_open_window(1,1,400,400,'blue',ThisHandle)
create_bar_code_model([], [], BarCodeHandle)
set_bar_code_param(BarCodeHandle,'element_size_max',8)
set_bar_code_param(BarCodeHandle,'check_char','present')
set_bar_code_param(BarCodeHandle,'persistence',1)
set_bar_code_param(BarCodeHandle,'composite_code','none')
set_bar_code_param(BarCodeHandle,'meas_thresh',0.1)
set_bar_code_param(BarCodeHandle,'num_scanlines',10)
set_bar_code_param(BarCodeHandle,'min_identical_scanlines',2)
set_bar_code_param(BarCodeHandle,'max_diff_orient',10)
set_bar_code_param(BarCodeHandle,'element_height_min',8)
set_bar_code_param(BarCodeHandle,'stop_after_result_num',1)
*read_image(img,'C:/Users/IBM_ADMIN/Desktop/Halcon/2.jpg')
*get_image_size (img, Width, Height)
*dev_set_window_extents (0, 0, Width-1, Height-1)
*find_bar_code(img,SymbolRegions,BarCodeHandle,'auto',DecodedataStrings)
*get_bar_code_result(BarCodeHandle,'all','decoded_types',DecodedDataTypes)
*dev_close_window()
* open computer camera
open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', -1, 'gray', -1, 'default', 'default', '0', -1, -1, AcqHandle1)
* open another USB camera
*open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', -1, 'gray', -1, 'default', 'default', '1', -1, -1, AcqHandle1)
condition := true
set_window_param(ThisHandle,'background_color','gray')
*grab_image_start(AcqHandle1,-1000)
while(condition)    
    *grab_image_async(BarImage,AcqHandle1, -1000)
    grab_image (BarImage, AcqHandle1)
    find_bar_code(BarImage,SymbolRegions,BarCodeHandle,'auto',scannString)
    if(|scannString| >= 1)
        dev_display(BarImage)
        disp_message(ThisHandle,scannString,'window',12,12,'blue','false')
        disp_continue_message(ThisHandle,'black','true')
        stop()
        condition := false
    endif
endwhile
clear_all_bar_code_models()
close_all_framegrabbers()
dev_close_window()