Getting started in Visual Basic
Top  Previous  Next

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

Creating the Control

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

clip0051


Selecting the Camera

In the properties window, click the Camera property. The list box will display all DCAM-compatible 1394 cameras conntected to your system. Select the one you intend to use:

clip0055


Selecting the Video Mode

In the properties window, click the Mode property. The list box will display all the video modes 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 will appear on the form in the ActiveDcam 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 ActiveDcam 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 ActiveDcam1_FrameAcquired()

      'the following line needs to be added to the code

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