问题描述:
英语翻译
Introduction
ActiveX EXEs are a versatile yet relatively uncommon application type unique to Visual Basic 6 development.These are applications that exhibit dual behavior:they can operate either as a standalone executable or as a DLL code library.ActiveX EXEs create an issue for developers moving their codebase forward to Visual Basic 2005 since ActiveX EXEs can neither be migrated to Visual Basic 2005,nor can they be created by or consumed from a .NET application.
The release of the Visual Basic 2005 Interop Forms Toolkit makes working with ActiveX EXEs easier:the Interop Forms Toolkit provides new capability that allows ActiveX EXEs to be extended with new .NET objects.In addition,Visual Basic 2005 makes the process of working with COM objects easier and more seamless than previous versions of Visual Basic.
This article shows how to add a Visual Basic 2005 form to a Visual Basic 6 ActiveX EXE and interact with the form.It also demonstrates how to invoke classes in a Visual Basic 6 ActiveX EXE from a Visual Basic 2005 application,and discusses options for upgrading code within an ActiveX EXE.
The Visual Basic Interop Forms Toolkit forms the basis of this solution.This toolkit is a free download that enables a Visual Basic 6 form to open a Visual Basic 2005 form,invoke methods,and use a shared property bag to pass state between the forms.
1.3 About ActiveX EXEs
ActiveX EXEs are a feature of Visual Basic 5 and 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.
Introduction
ActiveX EXEs are a versatile yet relatively uncommon application type unique to Visual Basic 6 development.These are applications that exhibit dual behavior:they can operate either as a standalone executable or as a DLL code library.ActiveX EXEs create an issue for developers moving their codebase forward to Visual Basic 2005 since ActiveX EXEs can neither be migrated to Visual Basic 2005,nor can they be created by or consumed from a .NET application.
The release of the Visual Basic 2005 Interop Forms Toolkit makes working with ActiveX EXEs easier:the Interop Forms Toolkit provides new capability that allows ActiveX EXEs to be extended with new .NET objects.In addition,Visual Basic 2005 makes the process of working with COM objects easier and more seamless than previous versions of Visual Basic.
This article shows how to add a Visual Basic 2005 form to a Visual Basic 6 ActiveX EXE and interact with the form.It also demonstrates how to invoke classes in a Visual Basic 6 ActiveX EXE from a Visual Basic 2005 application,and discusses options for upgrading code within an ActiveX EXE.
The Visual Basic Interop Forms Toolkit forms the basis of this solution.This toolkit is a free download that enables a Visual Basic 6 form to open a Visual Basic 2005 form,invoke methods,and use a shared property bag to pass state between the forms.
1.3 About ActiveX EXEs
ActiveX EXEs are a feature of Visual Basic 5 and 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.
问题解答:
我来补答展开全文阅读