Product Logo

CNS Barcode

Scan and Generate Barcodes

Functions

CNSBC_ScanWindow

NameCNSBC_ScanWindow
Description

This function is used to work with a scanning window that contains a live video stream from your webcam. The Action parameter determines what will be done as well as what other parameters are needed. The following Actions are supported:

  • “Show” - This will show the Scanning Window. With this action, the ProfileName parameter is also required and set to the name of the profile to use when a barcode is scanned. Use the Left and Top parameters to define where the window appears on screen. Use the WindowTitle parameter to specify the window title. You can use the “Show” action multiple times with different ProfileName and/or WindowTitle parameters to change those settings. If the ProfileName parameter specifies a profile with the “Return” action, then the scanning window will be presented modally with a “Cancel” button. Once a barcode is scanned (or if the “Cancel” button is pressed), the window will automatically hide.

  • “Hide” - This will hide the Scanning Window.

  • “State” - This will return the current state of the Scanning Window, whether it is visible or hidden.

  • “Move” - This will move the Scanning Window. Use the Left and Top parameters to define where to move the window on the screen. The other parameters are ignored.

Return TypeText
FormatCNSBC_ScanWindow ( Action ; ProfileName ; Left ; Top ; WindowTitle )
Required Parameters
Action

This parameter tells the plug-in what to do with the Scanning Window. Valid values are “Show”, “Hide”, “State”, or “Move”. To change the profile or the window title, you can call the function with the “Show” action again with different ProfileName and/or WindowTitle parameters.

Optional Parameters
ProfileName

When using the “Show” action, you must use this parameter to specify the name of the profile to use to process the barcodes that are scanned. This parameter is only valid with the “Show” action.

Left

This is the left pixel coordinate of the left-top corner of the scanning window. If you specify 0 or “”, the last known left pixel coordinate will be used. If you specify -1, the window will be centered horizontally on the screen. This parameter is only valid with the “Show” and “Move” actions.

Top

This is the top pixel coordinate of the left-top corner of the scanning window. If you specify 0 or “”, the last known top pixel coordinate will be used. If you specify -1, the window will be centered vertically on the screen. This parameter is only valid with the “Show” and “Move” actions.

WindowTitle

Use this parameter to specify an alternate title for the scanning window. This parameter is only valid with the “Show” action.

Examples
Example 1

This will show the scanning window and use the "MyProfile" profile to process any barcodes that are scanned. If the scanning window was already visible, this would switch it to using the "MyProfile" profile instead of whatever profile it may have been using before.

CNSBC_ScanWindow( "Show" ; "MyProfile" )
Example 2

This will hide the scanning window.

CNSBC_ScanWindow( "Hide" )
Example 3

This will move the scanning window (if it is open) to the center of the screen.

CNSBC_ScanWindow( "Move" ; "" ; -1 ; -1 )
Example 4

This will open the scanning window, using the "MyProfile" profile and setting the window title to "Hold a barcode up to the camera".

CNSBC_ScanWindow( "Show" ; "MyProfile" ; 0 ; 0 ; "Hold a barcode up to the camera" )