Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Aug 22, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

OLE Automation Versus Standalone Mode

There you are, creating an OLE server in Visual Basic. You go to Options in the Tools menu, select the Project tab, choose "OLE Server," and click on OK. After compiling, you run the executable. Is it an OLE server? Unfortunately, it's not. What makes a VB4 application an OLE server? You need at least one class module whose Public property is set to True and whose Instancing property is set to either "Creatable SingleUse" or "Creatable MultiUse." At this point, however you still do not have an OLE server: you have an application that is OLE Automation-enabled. If you were to create an instance of the exposed class via OLE Automation from another application, then it would be an OLE server. If the application is run normally, it is a standalone application. What is the purpose of the StartMode option in the Project options? Is this strictly for the design environment? When you are testing an OLE server with two copies of Visual Basic running, the one with "OLE Server" chosen can be started and will continue running even if no form ever loads. This feature allows the second copy of VB to test OLE Automation against the first. In addition, the first creates a temporary registry entry so that early binding may be tested as well. On another note, don't forget about the StartMode property of the App object. You can determine whether the app was started as a standalone or as an OLE server. Excel, for example, makes use of this by showing itself if it is a standalone, or by hiding itself if it is run via OLE Automation.
Pete W.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date