Description
Create an "operator and store a connection to it in the Object Manager.
-
Return Type
-
An Object object.
The new or existing interface instance.
-
Syntax
-
object.CreateOperator (ProgIDorCLSID, [varParent], [Name])
The CreateOperator Method syntax has these parts: |
| object | An expression evaluating to an object of type McEngine. | | ProgIDorCLSID | Required. A String value. 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 examples, you can just use the type name for virtually all operators.
As illustrated in Example 3, if a Name is given of an existing McObject or operator, then you may optionally leave the ClassID blank. If you do supply a ClassID along with a Name, then any existing operator of the given name must match the registered type of the ClassID argument.
| | varParent | Optional. A Variant value. If given, a parent operator interface or the McObject of the parent operator interface. If no parent is given, then a global instance of the operator interface is created. Most operators require a particular type of parent or ancestor to function (e.g., the McHistogram operator shown in the first example needs to be a descendent of a McImage instance). The CreateOperator method may fail if the proper type of parent is not supplied.
| | Name | Optional. A String value.
CRW2004-06-05 [in,defaultvalue("")] BSTR Name, [out,retval] IUnknown* *ppiunknownObject);
| Remarks
This function provides a convenient way to create an operator (an interface implementing IMcHasObject) and registering it in the McObjects Object Manager. This enables the interface to receive notifications and access other registered objects like McEngine or McEngine.Images.
You may optionally specify a parent operator (or its connected McObject) and/or a name. If both a name and parent operator are given, then the object becomes available by name from VB (see Example 2).
Exceptions
Creation will fail if there is a name collision between the given Name and another McObject or built-in property/method of the parent operator. Name collisions can be avoided by prepending the name with a namespace followed by ::, as in McObjMyNamespace::Value, but in this case you will need to use McObjects.Item and McObject.Interface to access the operator, because it will not be syntactically available from VB.
Creation may also fail if the operator, does not find the supplied varParent acceptable.
|