ActiveX

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Revision as of 01:08, 30 January 2007 by Woozle (talk | contribs) (New page: ==Overview== Although ActiveX is more widely known for its use (some would say misuse) in embedding Windows (Microsoft)-only applets within web pages, it is actually more useful f...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Although ActiveX is more widely known for its use (some would say misuse) in embedding Windows-only applets within web pages, it is actually more useful for regular Windows application programming.

Note: Does anyone know if there is anything comparable in the open-source world? I have heard mention of many data-exchange formats which sound as though they might be similar, but I have not progressed far enough in my understanding to determine whether they actually are. --Woozle 20:08, 29 January 2007 (EST)

ActiveX Application Programming

What ActiveX provides is an API for dynamically-loaded code libraries (which can be in either DLL or EXE form) to use to announce the function calls which they make available. This API greatly improves integration with integrated development environments; for example, Visual Basic 6 not only allows the human programmer to browse available ActiveX libraries and view the functionality available from them, but also extends its auto-fill capabilities to include the various identifiers (method names, global names, enums) exported by referenced ActiveX libraries as if they were part of the local Visual Basic code within the same project.

When writing an ActiveX module (or "an ActiveX" for short), you have to choose whether to make it an "ActiveX EXE", "ActiveX DLL", or "ActiveX Control". The EXE version has more options for threading, and there may be other differences as well. The Control type is intended for creating controls to place on forms, and in fact all of the controls available within VB, beyond the initial default set, are provided as ActiveX modules.

Once the module is compiled and running, it will appear in the list of "References" if it is an EXE or DLL, or the list of "Components" if it is a Control. These dialogs are found under the "Project" menu in VB6; in MS Access 97, they are found in the "Tools" menu but only when a code module is being edited.

Each ActiveX module has a file, a project name, and descriptive text associated with it. The list of ActiveX modules will show only the descriptive text, unless there is none in which case it will show the project name. (It is a good idea, therefore, to prefix the descriptive text with the project name, e.g. "MyProject: data services for doing stuff" rather than just "data services for doing stuff".) If the module is running within the VB IDE, rather than having been compiled to an EXE or DLL, the file's "name" will be that of the VB project file (e.g. MyProject.vbp). If you compile the project to a file, then VB will automatically "register" (see below) the compiled file for you so it will show up in the list.

Registering ActiveX Modules

There are two ways for other applications to become aware of the existence of an ActiveX module: (1) manual browsing, and (2) registration.

Many ActiveX modules are registered automatically by installer programs. VB6 (and presumably other ActiveX-capable IDEs) will automatically register ActiveX modules it compiles. Sometimes, however, you will need to be able to manually register (or un-register) an ActiveX module; this is done with the program RegSvr32.exe, which is provided as part of Windows 95, 98, 2000, and presumably later versions as well.