Getting started in Visual Basic
Top  Previous  Next

This chapter shows you how to get started with ActiveUSB control in VB 6.0. With just a few mouse clicks and one line of code, you will be able to display a live video image in your Visual Basic program and report a value of a selected pixel in real time.
.
Creating the Project

Assuming that you have already run the ActiveUSB installation program and started Visual Basic, the next step is to create a project. Begin by selecting the New Project command from the file menu, and select Standard EXE as your project type. Then use the Project / Components... command and select ActiveUSB Control from the list. You will see ActiveUSB icon appear at the bottom of the toolbox:

clip0051

Creating the Control

Click the ActiveUSB icon in the Toolbox and draw a rectangular area on the form. A rectangle with the text "ActiveUSB Control" will appear on the form, and the Project window on the right will display ActiveUSB's properties.


Selecting the Camera

In the properties window, click the Camera property. The list box will display all USB3 Vision™ cameras connected to your system. Select the one you intend to use:

clip0055


Selecting the Pixel Format

In the properties window, click the Format property. The list box will display all pixel formats provided by the selected camera. Choose the one you intend to use:

clip0058


Activating continuous acquisition

In the properties window, click the Acquire property and set it to "On". The live video should appear on the form in the ActiveUSB control's window.

clip0057


Adding a label

Click the label icon on the toolbox and draw a small rectangular area on the form outside of the ActiveUSB window. A label Label 1 will appear on the form.


Adding the FrameAcquired event

Double-click in the control window. The code window will appear with the empty FrameAcquired subroutine in it. It is now time to enter the single line of code mentioned earlier:

   Private Sub ActiveUSB1_FrameAcquired()

      'the following line needs to be added to the code

      Label1.Caption = ActiveUSB1.GetPixel (64, 32)

   End Sub


Running the application

You are now ready to hit F5 and watch your program display a live video and report a real-time pixel value in the coordinates x = 64, y = 32.