Impact AIT
Visual Basic 6.0 Edition


 

Return to Index
  ›Embedded CPM - VB6 - Bulb Demo

Using Visual Basic 6 for Embedded CPM

Embedded CPM - is used to exchange real-time information such as images, text, numbers, and regions of interest through an Embedded CPM Applet contained in this toolkit. Control Panel screens are created using Impact CPM, then saved as files and embedded into the client application. This technique uses "Impact-defined" data types which makes it ideal for experienced CPM users.

Notes: Java Runtime was installed by the AIT installation program. It must be installed to use Embedded CPM. It may be downloaded from Sun Microsystems.
An additional ActiveX control from Mozilla was installed and registered by the AIT installation program. If you need to manually install the control, it may be downloaded from http://www.iol.ie/~locka/mozilla/control.htm (Version 1.7.1) To register the control, in the command line navigate to the directory containing the file named mozctlx.dll, then type the command: regsvr32 mozctlx
The default AIT root distribution folder for this application is: /Datalogic/IMPACT/AIT/EmbeddedCPM/

Configure the vision device
Create the Visual Basic program
Create the HTML file to start the applet
Display the control panel in the VB program

Configure the vision device

1.       Start VPM and select the Settings tab.

2.       Select the File Manager, then select the Setup tab.

3.       Copy the file bulb demo.vp from the AIT distribution subfolder /VisualBasic6/Example1/IMPACT Files and paste it into the vision device folder
/IMPACT Root/VisionPrograms.

4.       Load the file named bulb demo.vp.

5.       Click the File Camera/Live Camera button to select File Camera mode.

6.       Load the images named bulb1.png through bulb10.png from the AIT distribution subfolder /VisualBasic6/Example1/IMPACT Files.

7.       Leave VPM open.

Create the Visual Basic program

1.       Start Microsoft Visual Basic 6.0. (Note: This sample code is in the AIT distribution subfolder /VisualBasic6/Example1/Project.)

2.       Select a new Standard EXE project type.

3.       From the project explorer, select Project1 and press F4.

4.       Rename the project to EmbeddedCPM.

5.       Press Ctrl-T to show the component selection dialog box.

6.       Select MozillaControl 1.0 Type Library and click OK.

7.       Select the properties (F4) and change the name from MozillaBrowser1 to EmbeddedCPMWindow

8.       Add a MozillaBrowser control to the form.

9.       Add a textbox to the form and change the name to URL.

10.    Add a button to the form and name it Get_Panel. Change the button caption to Get Panel.

11.    Double click the Get Panel button.

12.    Enter the following code between the beginning and end lines of the Get_Panel click event. (You may select and copy the code from this page, then paste it into the form.)

EmbeddedCPMWindow.Navigate URL.Text

13.    Save the project.

14.    Make an executable file from the project then run the executable. What does the program User Interface look like?

Create the HTML file to start the applet

1.       Open a text editor such as Notepad or Wordpad and enter the following text. (Note: This HTML file is in the AIT distribution subfolder /VisualBasic6/Example1/Project.) You may select and copy the code from this page, then paste it into the form.

<HTML>
<HEAD>
</HEAD>
<BODY>
<APPLET CODE="cpmreapplet.CPMREApplet.class" CODEBASE="\Datalogic\IMPACT\AIT\EmbeddedCPM\CPM\" ARCHIVE="CPMREApplet.jar" WIDTH="916" HEIGHT="613">
<PARAM NAME=-p VALUE="\Datalogic\IMPACT\AIT\EmbeddedCPM\VisualBasic6\Example1\IMPACT Files\Bulb Demo.cp",NAME=-d VALUE="">
</APPLET>
</BODY>
</HTML>

2.       The text after the word CODEBASE and the word VALUE should point to the directory where AIT was installed.

3.       Save the text file with the name EmbeddedCPM.html.

4.       To display the control panel Bulb Demo.cp in the default browser, double-click the HTML file.

Display the control panel from the VB application

1.       Select the running EmbeddedCPM application window.

2.       In the window text box, enter the full path to the file EmbeddedCPM.html and click the Get Panel button.

3.       The control panel Bulb Demo.cp will be displayed in the application window.


©2003-2013 Datalogic Automation Inc. All Rights Reserved