http://www.chrispearson.org/pages/programming/VB/ActiveX/default.asp
17h08
Thursday, 28. August 2008

ACTIVEX CONTROLS

ActiveX technology can be used to create executable files, DLLs and controls that can be placed in a web page, ActiveX Controls. Like a Java applet, an ActiveX control can be used to add huge power to a web site. It can also be used to quickly - and often very easily - achieve functionality that would be much harder to implement using a scripting solution.

ActiveX Controls pre-date .NET, allowing a browser to execute compiled code developed in Visual Basic, Visual C++ or one of a variety of other languages.

This article looks at ActiveX controls written in Visual Basic (VB6 is used in the examples) for basic, HTML web pages (Files with .htm extensions and no server-side processing)

 

Background

ActiveX Controls are common on the internet but much less so than Java Applets. On the open internet users tend to be suspicious of these powerful compiled programs. A system of signature and certification has been created to reassure users of any control's security status and its ultimate safety. But most of us (quite rightly, I think!) still have our reservations. (See also the Signing and Security section)

ActiveX and .NET

ActiveX is delivered to the client browser along with the rest of a web page's HTML. It is executed on the client machine.

Although there has been some rebranding of elements, components and suchlike, the advent of .NET doesn't affect ActiveX or other applet technologies. And ActiveX is not the same as web services!

.NET is a server-based technology (Microsoft's web servers) and only its output is sent to the client browser. The client browser never sees any .NET code or compiled applications, only ever its results.

Browser security options can restrict (indeed, totally disable) ActiveX controls in web pages. With .NET applications all the processing is done on the server, usually converting all their output to HTML code. The site visitor can't control .NET processing and, indeed, can be totally unaware of what - if any - processing is being carried out.

On an intranet, a secure extranet or on a trusted site an ActiveX Control is a more common sight, mostly because quite rich web applications are more common here and trust is inherent in the environment. So the security issues are side-stepped rather than solved. Also, a huge amount of effort - not to mention financial investment - went into creating such web applications (the bulk of it probably before the advent of .NET) and it isn't yet time for an upgrade.

ActiveX is a Microsoft technology and, as such, its use is restricted to the Windows environment which, again, is a restriction on its deployment across the internet.

ActiveX and VB

Since ActiveX is a Microsoft technology it isn't surprising that its development is supported in all the Visual languages. Things are changing with .NET but that needn't concern us here, since we're looking at creating and using an ActiveX Control on a simple HTML page and we're still talking about ActiveX Controls and not ADOs (or ActiveX Data Objects) And, to maintain the simplicity, we'll develop the code and compile it using VB. (If you have only Visual C++ to hand the similarities in compiling and deploying the control are so overwhelming that most of what follows is probably relevant to you, too.)

What follows applies to VB6, to VB5 and to VB '97.

VB provides support for ActiveX executables, ActiveX DLL and ActiveX Controls.

  Top of this page
 

Next:
Creating your own ActiveX Controls

Next page: Creating your own ActiveX Controls
 

xxx,xxx

copyright ©2000 - 2008 Chris Pearson