Activex objects, Creating imaq vision applications, Activex objects -5 – National Instruments IMAQTM User Manual

Page 15: Creating imaq vision applications -5, Objects. refer to the

Advertising
background image

Chapter 1

Introduction to IMAQ Vision

© National Instruments Corporation

1-5

IMAQ Vision for Visual Basic User Manual

Tip

Refer to the source code of the CWMachineVision control for an example of how to

use the CWIMAQVision methods.

ActiveX Objects

Use the objects to group related input parameters and output parameters to
certain methods, thus reducing the number of parameters that you actually
need to pass to those methods.

Note

ActiveX objects in

cwimaq.ocx

have a CWIMAQ prefix, objects in

niocr.ocx

have an NIOCR prefix, and objects in

cwmv.ocx

have a CWMV prefix.

You must create an ActiveX object before you can use it. You can use the

New

keyword in Visual Basic to create these objects. For example, use the

following syntax to create and store an image in a variable named

image

:

Dim image As New CWIMAQImage

Tip

If you intend to develop an application in Visual C++, National Instruments

recommends that you use IMAQ Vision for LabWindows/CVI. However, if you decide
to use IMAQ Vision for Visual Basic to develop applications for Visual C++, you can
create objects using the respective Create methods on the CWIMAQVision control or
CWMachineVision control. For example, to create a CWIMAQImage object, use the

CWIMAQVision.CreateCWIMAQImage

method.

Creating IMAQ Vision Applications

Figures 1-1 and 1-2 illustrate the steps for creating an application with
IMAQ Vision. Figure 1-1 describes the general steps for designing a
Vision application. The last step in Figure 1-1 is expanded upon in
Figure 1-2. You can use a combination of the items in the last step to create
a IMAQ Vision application. For more information about items in either
diagram, refer to the corresponding chapter listed beside the item.

Note

Diagram items enclosed with dashed lines are optional steps.

Advertising