Hi
How i connect to external like VB References to use it like this
Public BtApp As BarTender.Application
Public BtFormat As BarTender.Format
Well it’s been about 15 years since I’ve used VB and 10 years since I’ve used Xojo with COM on Windows but here goes:
Xojo has it’s own x-platform plug-ins but can also access COM/OLE when compiled for and run on Windows. From your question I take it you mean the latter (BarTender.Application sounds COM-ish) however for convenience, such VBA-like Automation can also be implemented in Xojo via a plugin created to make this easy such as the Office Automation Plugin: see http://documentation.xojo.com/index.php/Office e.g. the Office Automation plug-in has the “Reference” functionality Xojo needs to automate Microsoft Office via COM.
Xojo Plug-Ins
Xojo has a plug-in SDK: http://documentation.xojo.com/index.php/Xojo_Plugin_SDK
Such plug-ins are referenced by putting the required plug-in into the plugin folder of your IDE. See https://blog.xojo.com/2013/11/13/the-xojo-plugins-folder/
You don’t need to set a Reference by picking from the list as you would with VBA for example, but if you like, you can check if the “Reference” was found by pressing the “Loaded Plug-Ins” button in the Help/About dialog box. So if you have the Office plugin loaded you’re good to go with Office COM.
So if there’s a plug-in BarTender should now be available throughout your project and be suggested in auto-complete like any other global object.
COM
Xojo has COM classes that allow you to connect to COM objects on Windows. See http://documentation.xojo.com/api/windows/com.html These are lower-level than the Office Automation previously mentioned but can be used to create your own object models to simulate native VBA functionality in non-Office COM applications by creating your own classes for the purpose. For convenience to others using your COM objects (created in another tool), you could make your access class(es) available via a plug-in a similar way to how the Office Automation plug-in does for MS Office that ships with Xojo.
Using Xojo with your COM access classes or plug-ins
The equivalent of publicly scoped object variables in Xojo are publicly scoped Properties which may be added using the IDE to Xojo classes/objects and modules. So you could add a Property MyBarTender scoped as Public to a module in your app and set its type to BarTender
. Likewise MyFormat would be a public property set to type Format
. Then somewhere in your project’s code:
MyBarTender = New BarTender //populates the MyBarTender property with an instance of the BarTender Object
MyFormat = MyBarTender.Format
You can also manipulate COM objects without references by trying:
Set your module’s BarTender property as OLEObject
Set your module’s Format property to Variant
Then:
BarTender = New OLEObject("BarTender.Application", True)
Format = BarTender.Value("Format")
I guess you could then test Format to see what it is - e.g. an OLEObject, string etc.
See: https://documentation.xojo.com/topics/windows/activex-_com_and_ole.html
I have used this way of reliably using/controlling a COM server in the past, but it’s not as easy to program as having the references.