Skip to content

peAutoCreate - DfInPlaceComObject

Manipulates COM Object instantiation

Type: Property
Access: Read/Write
Data Type: Integer
Parameters: None

Syntax

Property Integer peAutoCreate
Access Type Syntax
Read Access: Get peAutoCreate to IntegerVariable
Write Access: Set peAutoCreate to IntegerVariable/Value

Description

COM Object instantiation can be manipulated via the peAutoCreate property.

Possible Values

Constant Meaning
acNoAutoCreate Do not automatically instantiate the COM object upon DataFlex object creation. You must manually instantiate the COM object using CreateComObject
acAutoCreate Automatically instantiate the COM object upon DataFlex object creation. You won't need to manually instantiate the COM object.
acDeferredAutoCreate Automatically instantiate the COM object when it is paged (during Activate), and to be automatically destroyed when it is unpaged (during Deactivate).

For ActiveX controls, the default peAutoCreate value is acDeferredAutoCreate.

For ActiveX controls you also have the option of setting peAutoCreate to acAutoCreate. This automatically instantiates the COM object when its DataFlex COM wrapper object is created. This means that the COM object will now exist and retain its state even when it's not paged, just like any other DataFlex control. This might seem like the most desirable setting for all ActiveX controls but you need to be careful when using the acAutoCreate setting. Certain ActiveX controls exhibit problems when invoking methods and setting properties while they're not displayed. For that reason the setting of acDeferredAutoCreate is considered safe in all cases. If you want your ActiveX control to retain its state while it is not visible, then you can use the acAutoCreate setting but it will be up to you to ensure that the control will operate without errors.

Some ActiveX controls are not visible by design. In these cases it is better for the COM object to be created at the same time as its DataFlex wrapper. This is because controls that are invisible, are controls that won't have any problems with setting properties when they're not displayed (they will never be displayed). Also, controls that are invisible are also controls that you are likely to want to use as soon as the DataFlex wrapper object has been created. The FlexCOM class generator has been designed to take this into consideration. It detects whether the object is invisible at runtime, and then sets peAutoCreate property of the generated wrapper class to acAutoCreate if it is invisible at runtime; otherwise it is set acDeferredAutoCreate.

See Also

cComActiveXControl