Impact AIT
Visual Basic .NET Edition


Return to Index
  ›Embedded CPM – VB .NET - Bulb Demo

Using Visual Basic .NET 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.
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 /VBNetEmbeddedCPMSample/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 /VBNetEmbeddedCPMSample/IMPACT Files.

7.       Leave VPM open.

Create the Visual Basic program

1.       Start Microsoft Visual Basic .NET. (Note: This sample code is in the AIT distribution subfolder /VBNetEmbeddedCPMSample/VBNetEmbeddedCPMSample.)

2.       From the File menu, select New Project.  From the New Project Template, chose the project type Windows Forms Application, and enter VBNetEmbeddedCPMSample for the name.

3.       From the Common Controls Toolbox, select the WebBrowser control, and drop it onto the form.

4.       From the properties window, change the name from WebBrowser1 to EmbeddedCPMWindow.

5.       Change the Anchor property to None, then place and size the control on the form.

6.       Add a TextBox to the form and change the name to URL.

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

8.       Double click the Get Panel button.

9.       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

10.    Save the project.

11.    Make an executable file from the project by running the project.(F5)

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 / VBNetEmbeddedCPMSample./EmbeddedCPM.html)  You may select and copy the code from this page, then paste it into the file.

<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\ VBNetEmbeddedCPMSample \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.

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

©2003-2013 Datalogic Automation Inc. All Rights Reserved