Getting started in Visual Basic
Top  Previous  Next

This chapter shows you how to get started with ActiveGeni 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 ActiveGeni 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 ActiveGeni Control from the list. You will see ActiveGeni icon appear at the bottom of the toolbox:

Creating the Control

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

clip0051


Selecting the Camera

In the properties window, click the Camera property. The list box will display all GenTL-compatible devices 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 ActiveGeni 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 ActiveGeni 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 ActiveGeni1_FrameAcquired()

      'the following line needs to be added to the code

      Label1.Caption = ActiveGeni1.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.