TEC-IT Barcode ActiveX Control |
Part 2 COM Object Model, ActiveX Architecture, and Programming Interfaces |
12. Fundamental Nature of the ActiveX Control as a COM Component |
12.1. The TEC-IT Barcode ActiveX Control is fundamentally a COM (Component Object Model) object packaged as an ActiveX control, typically distributed as an OCX or DLL file registered in the Windows system registry. |
12.2. Unlike modern managed components, this control: |
* Executes as native compiled code |
* Relies on COM reference counting |
* Uses binary interfaces rather than metadata-based reflection |
12.3. The design choice of COM provides: |
* Language neutrality |
* Binary compatibility across versions |
* Stability for long-lived enterprise systems |
12.4. This COM-based design allows the control to be consumed by any environment capable of: |
* Creating COM objects |
* Calling IDispatch or v-table interfaces |
* Handling OLE Automation types |

|
13. ActiveX Control vs. Plain COM Automation Object |
13.1. The Barcode ActiveX Control is not merely an automation object, but a visual ActiveX control. |
13.2. This distinction is important because it means: |
* The control can be placed on a form at design time |
* It supports visual rendering at runtime |
* It integrates into GUI layout systems |
13.3. Internally, the control implements: |
* Visual container interfaces |
* OLE drawing interfaces |
* Window message handling |
13.4. At the same time, it exposes a fully scriptable automation interface, enabling: |
* Headless barcode generation |
* Background rendering |
* Printer-only output |

|
14. Registration and Instantiation Lifecycle |
14.1. Before use, the ActiveX control must be: |
* Installed on the system |
* Registered using standard COM registration mechanisms |
14.2. Registration creates: |
* CLSID entries |
* ProgID mappings |
* Type library references |
14.3. Once registered, client applications can instantiate the control via: |
* Design-time insertion (VB6 toolbox) |
* Runtime creation using CreateObject |
* Embedded object initialization |
14.4. The instantiation lifecycle follows standard COM rules: |
* Object creation |
* Property initialization |
* Method invocation |
* Reference release |
14.5. Proper lifecycle handling is critical in long-running applications to prevent: |
* Memory leaks |
* GDI resource exhaustion |
* Handle accumulation |

|
15. Type Library and Early vs. Late Binding |
15.1. The control exposes a type library describing: |
* Interfaces |
* Properties |
* Methods |
* Enumerations |
15.2. Early binding environments such as Visual Basic 6: |
* Reference the type library at design time |
* Provide IntelliSense-like code completion |
* Enforce compile-time type checking |
15.3. Late binding environments such as VBA or scripting: |
* Resolve members at runtime |
* Use string-based property access |
* Trade safety for flexibility |
15.4. The control is carefully designed to support both binding modes, which is essential for broad compatibility. |

|
16. Core Object Model Overview |
16.1. Conceptually, the Barcode ActiveX Control exposes a single primary object, representing one barcode instance. |
16.2. This object encapsulates: |
* Barcode data |
* Symbology configuration |
* Visual appearance |
* Output parameters |
16.3. Rather than exposing dozens of sub-objects, the design favors: |
* Flat property sets |
* Explicit method calls |
* Predictable behavior |
16.4. This approach simplifies usage in: |
* VBA macros |
* Script-driven automation |
* Form-based applications |

|
17. Property-Based Configuration Philosophy |
17.1. Configuration of the barcode is primarily achieved through properties rather than constructor arguments. |
17.2. This aligns with the ActiveX design philosophy where: |
* Properties can be set visually at design time |
* Properties can be modified dynamically at runtime |
17.3. Typical property categories include: |
* Data content |
* Symbology selection |
* Dimension control |
* Text display options |
* Output resolution |
17.4. Each property setter triggers internal validation to ensure: |
* Data conforms to symbology rules |
* Values are within acceptable ranges |

|
18. Barcode Data Input Semantics |
18.1. The data to be encoded is provided as a string-based property. |
18.2. Internally, the control: |
* Parses the input |
* Applies character set restrictions |
* Computes mandatory check digits if required |
18.3. For symbologies that support structured input, the control handles: |
* Control characters |
* Application identifiers |
* Escape sequences |
18.4. This relieves the application developer from manual encoding logic. |

|
19. Symbology Selection Mechanism |
19.1. The barcode type is selected via a dedicated property, typically represented by: |
* An enumeration value |
* A numeric identifier |
19.2. This design avoids string-based ambiguity and ensures: |
* Compile-time validation in early-bound environments |
* Efficient runtime switching |
19.3. Internally, the selected symbology determines: |
* Encoding algorithm |
* Allowed character set |
* Symbol layout rules |
* Error detection or correction logic |

|
20. Dimensional Control and Measurement Units |
20.1. Barcode size control is one of the most critical aspects of barcode generation. |
20.2. The ActiveX control exposes properties for: |
* Module width |
* Barcode height |
* Quiet zone size |
20.3. Measurements are typically expressed in: |
* Millimeters |
* Inches |
* Device-independent units |
20.4. The control converts these values internally to device-specific pixels based on: |
* Screen DPI |
* Printer resolution |

|
21. Rendering Target Abstraction |
21.1. The control abstracts the rendering target so that the same barcode configuration can be rendered to: |
* On-screen display |
* Bitmap objects |
* Printer device contexts |
21.2. This abstraction is crucial for reuse and consistency. |
21.3. Developers do not need to change encoding logic when switching from: |
* Preview mode |
* Print mode |
* Export mode |

|
22. Visual Rendering Pipeline |
22.1. Once properties are set, rendering follows a deterministic pipeline: |
22.1.1. Data validation |
22.1.2. Encoding into logical modules |
22.1.3. Layout computation |
22.1.4. Scaling to target resolution |
22.1.5. Drawing using GDI primitives |
22.2. The rendering pipeline is fully internal and shielded from the application layer. |

|
23. Use as a Design-Time Control |
23.1. In environments like Visual Basic 6, the ActiveX control can be: |
* Dropped onto a form |
* Resized visually |
* Configured through property grids |
23.2. This allows rapid development of: |
* Label layouts |
* Document previews |
* Interactive forms |
23.3. Design-time rendering provides immediate visual feedback, which is especially valuable in legacy RAD environments. |

|
24. Use as a Non-Visual Automation Object |
24.1. The same control can be used without ever being displayed on screen. |
24.2. In this mode, it functions as a: |
* Barcode rendering engine |
* Printer output component |
* Bitmap generator |
24.3. This dual-use capability significantly increases the control versatility. |

|
25. Error Handling and COM Exception Semantics |
25.1. Errors are communicated using standard COM mechanisms: |
* HRESULT return values |
* Automation exceptions |
25.2. In early-bound environments, errors can be caught via structured error handling. |
25.3. In late-bound environments, error information is available through: |
* Error objects |
* Descriptive messages |
25.4. The control provides meaningful error descriptions to assist debugging in legacy environments. |

|
26. Threading Model Considerations |
26.1. The ActiveX control is designed primarily for: |
* Single-threaded apartment (STA) usage |
26.2. This aligns with: |
* VB6 runtime behavior |
* VBA execution model |
26.3. Developers must be aware of threading constraints when using the control in: |
* Multi-threaded COM hosts |
* Server-side Classic ASP |

|
27. Binary Compatibility and Versioning Strategy |
27.1. One of the most important design goals is binary compatibility. |
27.2. TEC-IT carefully evolves the control to: |
* Preserve existing interfaces |
* Avoid breaking changes |
* Extend functionality safely |
27.3. This ensures that: |
* Existing applications continue to run unmodified |
* Updates do not require recompilation |

|
28. Relationship to Other TEC-IT Components |
28.1. Internally, the ActiveX control shares encoding logic with other TEC-IT products, including the TBarCode SDK. |
28.2. This shared core guarantees: |
* Identical barcode output |
* Uniform standards compliance |
* Predictable behavior across platforms |
28.3. The ActiveX control can therefore be viewed as a legacy-compatible facade over a modern barcode engine. |

|
29. Summary of Part 2 |
29.1. The TEC-IT Barcode ActiveX Control is a fully-fledged COM-based visual and automation component. |
29.2. Its object model emphasizes: |
* Simplicity |
* Stability |
* Broad compatibility |
29.3. The control architecture reflects decades of real-world enterprise usage, prioritizing: |
* Predictable behavior |
* Long-term maintainability |
* Integration with legacy tools |