COM Forwarding

Make COM extensions cloud-ready with COM Forwarding

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 15.03.2024
Machine translated
Updated: 29.04.2024 | Added description to vtccom.createobject() and registry key.

Some Vertec extensions to third-party programs are based on a Com extension to the third-party system. However, since the connection only works locally, i.e. on the same computer, these extensions are not cloud-ready and can only be used with the Vertec desktop app and therefore only on-premises.

With COM Forwarding we are introducing with Vertec 6.7.0.7 a system with which COM objects of the external system can also be accessed from the cloud app.

For example, COM forwarding objects can be used in the server-side Python code, whose actions are then forwarded to the cloud app and applied there to the actual COM objects of the third-party program.

Module vtccom

The functionalities for COM forwarding are included in the module vtccom , which is also available as a Stub File .

The feature vtccom.createobject(<progid>) returns a COM object that can be used in Python (see example below).

  • In the desktop app, the COM object is created directly from the app using the Python COM system (win32com.client) was created. This corresponds to the previous use of COM objects from Python.
  • In the cloud app, the COM object is created by the cloud app on the client system via COM forwarding. All interactions with the resulting Python object are transferred to the cloud app and applied there to the actual COM object.

Rebuild existing, non-cloud-ready extensions

Extensions that use COM forwarding also work unchanged in the desktop app.

If you use extensions with COM access to third-party programs in Vertec (other than the standard ones) and want to adapt them to COM forwarding, you need to make the following changes:

vtccom.createobject() instead of win32com.Dispatch()

The COM objects are called by means of vtccom.createobject(identifier) instead of win32com.Dispatch.

To do this, the module vtccom must be imported and the calls changed as follows:

New Previously
import vtccom
self.invoice = vtccom.createobject('ThirdPartyAPI.Invoice')
from win32com.client import Dispatch
self.invoice = Dispatch('ThirdPartyAPI.Invoice')
import vtccom
word = vtccom.createobject("Word.Application")
word.Visible = True
doc = word.Documents.Add()
doc.SaveAs(r"C:\temp\Test Document.docx")
from win32com.client import Dispatch
Word = Dispatch('Word.Application')
Word.Visible = True
doc = Word.Documents.Add()
doc.SaveAs(r"C:\temp\Test Document.docx")

To ensure backward compatibility, vtccom.createobject() in the desktop app the original Com object .

Removing non-approved modules

In order for the extensions to work with COM forwarding also with Restricted Scripting , calls to modules such as sys or pywintypes must be extended. Only modules that are on the Whitelist may be used.

Compatibility with COM objects

Depending on the implementation of the third-party product used (COM Server), incompatibilities may occur with COM Forwarding. In these cases, the COM Server can only be used in the desktop app.

Security

To prevent a script with COM forwarding on the server from running code in the cloud app unnoticed, the client user is asked for permission once each time a COM server is called on the client, and this permission is saved for future calls on the client.

When accessing a COM server via COM Forwarding (call of vtccom.createobject()) a dialog appears in the cloud app that a server script tries to access this object on the client.

  • If access is granted, the script is executed and the permission is saved on the client. The query does not appear on future calls to the same COM server.
  • If access is not allowed, the execution aborts without a message appearing. If the call is repeated, the message appears again.

The accounting interfaces with COM Forwarding supplied by us are already stored. Therefore, this query does not come to them even when they are called up for the first time.

The approved COM servers are saved in the registry key HKEY_CURRENT_USER\SOFTWARE\Vertec\ComObjectWhitelist.