Click or drag to resize

IMcEngineCreateObject Method

Create a COM object, and if an "operator", store a connection to it in the Object Manager.

Namespace:  MediaCy.IQL.Engine
Assembly:  MediaCy.IQL.Engine (in MediaCy.IQL.Engine.dll) Version: 10.0.6912.0
Syntax
VB
Function CreateObject ( 
	ProgIDorCLSID As String
) As Object

Parameters

ProgIDorCLSID
Type: SystemString
Registered Prog ID of the "coclass" of this object. Or the CLSID in a form like "{DC2F6FCB-08A7-40c0-BBDB-D3894B1C5F68}"; the braces are required. If the class has already been registered with the McObjects object manager, then just the registered type name is required. The registered type name is the portion of the ProgID after the first period up to any second period. All coclasses in the Image Pro type library are registered at start up, so as illustrated in the example, you can just use the type name for virtually all "operators".

Return Value

Type: Object
The new interface instance.
Remarks
This function provides an extension of the standard VBA CreateObject method that handles classes that are "operators" as well as ordinary COM classes. An instance of the specified class is created, and then an "operator" (an interface implementing IMcHasObject) is registered in the McObjects Object Manager. Registration with McObjecs enables the interface code to receive notifications and access other registered objects like Engine or Engine.Images. The CreateOperator method is the preferred method for creating "operators". This method is mostly a fallback to ensure that a version of the standard "CreateObject" method is available that properly registers operators.
Note Note
In Example 2, "Engine.CreateObject" was used to avoid ambiguity with the VBA version of "CreateObject". Example 3 illustrates that this potential confusion is not a problem when using the preferred CreateOperator method for creating operators. In Example 1, where CreateObject is being used to create an ordinary, non-operator class object, it doesn't matter if the VBA version of CreateObject is called, because for such classes it does the same job as Engine.CreateObject. If a operator is created, its connected McObject is unnamed and has no parent. Should you wish to create an operator with either a name and/or parent, use the CreateOperator method instead. If an operator is created, then it is part of an McObjects category named "CreatedOperator". For "operators", the connected McObject does not hold a reference on this interface, but instead when the last reference to the interface is released, the connected McObject is also released and removed from the McObjects collection.
Examples
VB
'Example 1. Create a non-operator class object instance
Dim myClass As IMyClass
Set myClass = CreateObject("MyLibrary.MyClass.1")
'Example 2. Create a global operator from a registered type name
Dim NewSpatialCalib As McSpatialCalib
Set NewSpatialCalib = Engine.CreateObject("McSpatialCalib")
'Note that the full ProgID of "McCalibLib.McSpatialCalib" is not needed
'Example 3. Preferred way to do Example 3, using CreateOperator
Dim NewSpatialCalib As McSpatialCalib
Set NewSpatialCalib = CreateOperator("McSpatialCalib")
'Note that the disabiguating "Engine." is not required
See Also

Reference

The
standard
IMcEngineCreateObject(String)
in
the
VBA
[T:MediaCy.IQL.Engine.IMcEngine.]