受欢迎的博客标签

VB6.0- What's the difference between standard exe, activex.exe, ActiveX DLL, ActiveX Control and OLE server?

Published

 

What is an ActiveX EXE application?

An ActiveX EXE application is one that is created using ActiveX EXE project. ActiveX EXE are widely used in conjunction with standard EXE applications. There are three types of widely used of ActiveX projects. These are:

a. ActiveX EXE
b. ActiveX DLL
c. ActiveX Control

ActiveX EXE-ActiveX Automation,Automate one application from within another application. For example, a vbacomserver program can control Microsoft Excel using ActiveX Automation.

Unlike a stand-alone EXE file, an ActiveX EXE file is designed to work as an OLE server, which is nothing more than a program designed to share information with another program. It has an .EXE file extension.

 

An ActiveX exe server is the application that exposes its features.An ActiveX server exports its features as a set of ActiveX objects. For example, Microsoft Excel exposes its workbooks, worksheets, and charts as ActiveX objects. Each ActiveX object provides methods and properties that other applications can access.

ActiveX DLL-

 

ActiveX Control-Use stand-alone, interactive objects in external applications. For example, you can embed and use a Microsoft Calendar control or a Measurement Studio 3D Graph control in containers such as LabWindows/CVI panels.

An ActiveX controller is the application that uses the features of an ActiveX server. For example, the Microsoft Excel worksheet object provides a calculate method that calculates the values in a worksheet.

 

ActiveX EXE/DLL Usage

The ActiveX EXE/DLL is normally used when you need to build a component that is separate from the main program. The concept is based on COM model.


ActiveX DLL/EXE allows multiple applications to share the same code. This allows for scalability of programs, and saves time because you only need to write the code once.


ActiveX DLLs and ActiveX EXEs are almost same in the ways they are built and used. In either case, you build one or more classes that applications can use to do something.


One of the main differences between ActiveX EXE and an ActiveX DLL's is that the code is executed within the main program's address space for ActiveX DLL. This is because the code lies inside the program's address space, calling methods and execution of code is very fast.

Compare Standard EXE ActiveX EXE/DLL projects

ActiveX EXEs are a feature of  Visual Basic 6 development. They are code library DLLs that can also be run as an executable. ActiveX EXEs differ from traditional DLLs in several ways:

Run in their own process. Whereas normal DLLs run in the memory process of their parent application, ActiveX EXEs run in their own process. This means they show up as separate applications in Task Manager. It also means ActiveX EXEs are slower than DLLs since Windows has to do extra work to marshal variables when they are passed to and from an ActiveX EXE.


Class instancing. ActiveX EXEs have two class instancing modes not available to normal DLLs and executables: SingleUse and GlobalSingleUse, both of which ensure that a separate copy of the class is loaded into memory whenever an instance is created.
Remote execution. It is possible to invoke classes in an ActiveX EXE on a remote computer. In Visual Basic 5 and Visual Basic 6, the only other way to execute code on a remote computer was by creating DLLs hosted in Microsoft Transaction Server.
Multi-threading. Because ActiveX EXEs run in their own process, they are allocated their own thread. In theory, this enables multi-threading in a Visual Basic 5 or Visual Basic 6 application. In practice, this is problematic since the calling application must wait for the called method in the ActiveX EXE to finish execution before continuing, giving a user-experience that is the same as a single-threaded application.

 


     An ActiveX Exe provides the reusability of code, by accessing 
     it from different clients.


     An ActiveX Exe is a component that can be called by another 
     application by providing a reference to the component. But a 
     Standard Exe application cannot be called in this way.


     An ActiveX EXE's code is run in a separate process. When 
     the main program calls an ActiveX EXE's method, the application 
     passes required parameters into the ActiveX EXE's and calls 
     the method. The ActiveX EXE, upon execution may return the results 
     to the main program. This is slower than running an ActiveX 
     DLL's method inside the main program's address space.