How On-Premises customers can get their COM extensions, only running in the Vertec Desktop App, ready for the future
Working with com in conjunction with Vertec has always been possible in Vertec Desktop App. In recent years COM with Vertec has been expanded so that this is possible with Vertec Cloud App: Through a COM proxy for the Vertec com extension (access Vertec from the extension) and Com forwarding for access from Vertec to third-party programs.
The variants via COM Proxy and COM Forwarding also work with the Vertec Desktop App. Since the Desktop App is set to Vertec 7.1, conventional COM extensions should be modified accordingly to be able to run even after this version.
In this article, we describe the differences and how you can retrofit your extensions.
The Vertec Type Library included in Vertec.Desktop.exe and Vertec.Cloud.exe can be integrated into the external application to gain access to the object catalog and thus to code completion and compile-time type checking.
The COM proxy knows the type library and thus types like IVtcObject, App etc. but not. The declaration of objects, object lists, session must therefore always be Object shall read. For:
Dim Projektbearbeiter as IVtcObject
so you write:
Dim Projektbearbeiter as Object
The corresponding Com interfaces are available during operation as soon as the object is loaded.
Since the COM server is available directly for the Desktop App and via proxy for the Cloud App, different interface names result. However, the features and features available on them are identical, so that nothing changes during use.
As soon as the access or the declaration is changed as described above and is no longer done via Type Library types, this is irrelevant. However, to help you find your way around the description of the individual Com interfaces, here are the differences:
| Type Library | COM Proxy |
|---|---|
| app (Ivtcsession) | ComCoClass |
| IVtcObject | VtcObjectProxy |
| IVtcObjectList | VtcObjectListProxy |
| ITimEditor | TimEditorProxy |
| ... | ... |
The handover of as Variant Declared Vertec objects in features was not possible when using the Type Library and declaring Vertec objects as these types. An invalid procedure call or invalid argument message appeared .
Via COM Proxy and the declaration of Vertec objects as Object (see above) this works without any problems.
In the desktop Desktop App created directly from the app using the Python COM system (win32com.client) established (win32com.Dispatch).
COM Forwarding creates the COM object on the client system (vtccom.createobject(identifier)). The interactions with the resulting Python object are then transferred to the Cloud App and applied to the actual COM object. In the Desktop App, the original COM object is returned.
To switch to COM Forwarding, the module vtccom must be imported and the calls must be changed as follows:
| COM Forwarding | So far |
|---|---|
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") |
In order for the extensions with COM Forwarding to work with Restricted Scripting, calls to modules such as sys or pywintypes must be modules. Only modules that are on the Whitelist may be used.