Using the ROV Scanner ActiveX Control in Windows
Developer Articles
The Microvision ActiveX control allows you create a very simple and effective scanner interface. The ActiveX control can be used in custom applications, applications that support VB Script, web pages, etc. The ActiveX control provides a simple scanner interface without requiring the full SDK. To use the ActiveX control you must register the ActiveX DLL and enable BC Data ACK on the scanner using either a control bar code or by sending a configuration command to the scanner (using the ActiveX control). Follow these steps to integrate scanning into your application using the ActiveX control:
1. Create a new project or open your existing project
2. Register the ActiveX control
Copy the ActiveX file (BcsCtl.dll) in a directory on your host computer. If you have a single scanner project then you can copy this file into your application directory, otherwise, copy the file to a directory that all of your scanner applications can access. Get into a DOS prompt by selecting Start > Programs > Accessories > Command Prompt. Navigate to the ActiveX file and type Regsvr32 bscCtl.dll to register the control.
3. Add Control to Visual Studio
In order to use the ActiveX control you must first add the it to your project and then you can use it as you would any other Windows control. You can select it from the toolbox, drop it onto a dialog, access its properties and events, add code, etc. The ActiveX control is based on the List Box control and has many of the same properties.
VB6: Select Project > Components > Controls (tab) and check BcsCtl x.x Type Library and press OK.
.NET: Select Tools > Choose Toolbox Items…, select the COM Components (tab), and check BcsCtl x.x Type Library and press OK.4. Add Control to Project
Select the ActiveX control from the tools list and place the BcsCtl object it on a dialog box. The BcsCtl object appears as a list box that displays the available COM ports. This also displays any other paired Bluetooth devices. Visual Studio assigned the default name BcsConn1 or axBcsConn1 to the control. You change easily change this name, if desired. “BcsConn1” is used for the remainder of this example.
VB6: Select the BcsCtl object by clicking on the Microvision logo on the project option screen.
.NET: Select the BcsCtl object from the Toolbox (generally on the bottom of the list of tools).5. Add a Callback function
To read and process the scanned bar codes as they arrive on the host. This works for both tethered and batch operation.
VB6: Above the code or object window are two dropdown lists. Select the BcsConn1 object from the list on the left. After selecting BcsConn1, select BarCode from the list on the right. Visual Studio then adds the BcsConn1_BarCode function shell. This function is called when a bar code is detected. Add your own code to process the bar code to this function.
.NET: Right-click on the BcsCtl control and then move to the list of Properties for the control. There are a set of icons below the Properties title. Press the Events icon (the lightning bolt icon) to display the list of the events for the BcsCtl control. Double-click on the BarCode event and the IDE creates a callback function.6. Configure the Scanner
Be sure to set BcDataAck to true. When configuring the scanner it is good practice to set it back to its factory default settings and then set all the parameters that are appropriate for your application. This way the scanner is set to a known state and new scanner will be configured properly no matter how they were configured previously. In each of these code samples the following commands are sent to the scanner:
//***** C#.NET *****
BcsConn1.Command("RestoreFactorySettings", null);
BcsConn1.SetProp("AutoDownload", true);
BcsConn1.SetProp("BcDataAck", true);
BcsConn1.SetProp("Time", System.DateTime.Now);
‘***** VB6 *****
BcsConn1.Command "RestoreFactorySettings", ""
BcsConn1.SetProp "AutoDownload", True
BcsConn1.SetProp "BcDataAck", True
BcsConn1.SetProp "Time", DateTime.Now
‘***** VB.NET *****
BcsConn1.Command("RestoreFactorySettings", "")
BcsConn1.SetProp("AutoDownload", True)
BcsConn1.SetProp("BcDataAck", True)
BcsConn1.SetProp("Time", System.DateTime.Now
