ActiveX, COM and OLE
OLE (Object Linking and Embedding) and COM (Component Object Model) are ways to communicate with Windows objects in your applications. ActiveX describes controls that utilize COM or OLE. All of these features are Windows-specific and cannot be used in a cross-platform app.
OLEObject can be used to send messages to other Windows apps that support OLE, such as Internet Explorer. Use the Value method to get and set values of the OLE object. Use the Invoke method to call methods (with or without arguments) on the OLE object.
This code creates a connection to Internet Explorer and then tells it to display Wikipedia:
Var obj As OLEObject Var v As Variant Var params(1) As Variant obj = New OLEObject("InternetExplorer.Application", True) obj.Value("Visible") = True params(1) = "http://www.wikipedia.org" v = obj.Invoke("Navigate", params) Exception e As OLEException MessageBox(e.message)
DesktopOLEContainer is used to embed ActiveX controls into your apps.
To use an OLEContainer, you drag it from the Library onto a Window. In the ProgramID property of the Inspector, you specify the program ID for the control. You can access the properties and methods of the ActiveX by using the Content property, which returns an OLEObject where you can use the Value and Invoke methods.
This code (in a Button's Pressed event) displays a PDF in an Adobe Reader ActiveX OLEContainer that has been added to a window:
PDFContainer.Content.Value("Src") = "C:\\Document.pdf"
Depending on the version of Adobe Reader, you may need to click on the container before the PDF is displayed.
To print the PDF in the OLEContainer, you can call the “printWithDialog” method of the Adobe Reader ActiveX control:
Using Insert ActiveX component
You can also directly add ActiveX controls and automatable/OLE objects by selecting Insert > ActiveX Component from the menu. This displays a window with two tabs: Controls and References. The Controls tab lists the ActiveX controls that you can add to a window. The References tab lists the automatable COM objects are are not controls, like the iTunes Library, Microsoft Word, etc.
When you select an item and click OK, a module (containing classes for the component) is added to your project for you to use. Refer to the docs for the component to understand how to use its classes, methods and properties.
Note that not all ActiveX controls can be used with Xojo.