ActiveX Controls for Mac
Volume Number: 13
Issue Number: 6
Column Tag: Webtech
ActiveX Controls for Macintosh
by Michael Fanning, Microsoft
Microsoft's next generation of content-rich web page
development
Macintosh ActiveX is Microsoft's native implementation of ActiveX controls for the
Macintosh platform. A "control" can be loosely defined as a next-generation plug-in
technology for Web browsers such as Microsoft's Internet Explorer, Netscape
Navigator, and (soon) Apple's Cyberdog browser part. Controls can also be used to
quickly add specialized functionality to desktop applications and development tools in
addition to Web sites. Mac ActiveX provides a powerful environment for developing
interactive and content-rich Web pages. ActiveX on the Macintosh retains much of the
ActiveX programming model on the Win32 platform and most features; there are, not
surprisingly, some important architectural differences.
Mac ActiveX is built on the Component Object Model (COM), a simple object model that
provides mechanisms for object instantiation, object querying and object reference
counting (a means of controlling object usage & lifetime). COM interfaces allow for
flexible object design and are semantically equivalent to Java interfaces (for a
definition of COM interfaces, see the beginning of the 'Architectural Overview' section
at the end of this article). Macintosh ActiveX is based on a lightweight COM library
which has been optimized for in-process controls. These services allow ActiveX
controls to work seamlessly within a browser rather than as separate processes.
Other advanced features of Mac ActiveX make the experience of ActiveX controls more
seamless than plug-ins. Transparent download, for example, permits a control to be
downloaded, installed, and activated in a Web page without requiring the browser to be
restarted or that the user go through any installation procedure.
This article presents a general architectural overview of Mac ActiveX and a detailed
description of its software development kit. The last half discusses the mechanics of
building and running ActiveX controls and details a simple modification of an SDK
sample in order to create a new, custom control. Much of the information here appears
in two essential SDK documents, the ActiveX User's Guide and ActiveX Technical Guide.
There are pointers to additional SDK documents and other references where topics to
which I refer are beyond the scope of this article. I've included definitions of some
important, basic terms and concepts as they appear for anyone who might be
encountering them for the first time.
The final section of the article contains important information on obtaining technical
support from Microsoft for developing ActiveX controls on the Macintosh.
ActiveX and Java
ActiveX and Java are complementary, not competing technologies. First and foremost,
Java is a programming language. Second, Java is a set of virtual machine bytecodes
that can be executed on any platform running a Java Virtual Machine (VM). Third,
Java is a set of programming interfaces that define the underlying services available
from Java code.
ActiveX, on the other hand, provides a totally different set of benefits focused on
integrating objects created in Metrowerks' CodeWarrior environment with Web pages.
ActiveX controls are native Mac applications and can be written using any of the rich
MacOS services available through C or C++ interfaces.
ActiveX, OLE, and COM
ActiveX and OLE for Macintosh are both built on the powerful foundation of the
Component Object Model. The 2.0x version of OLE was a monolithic release which
incorporated COM and the OLE libraries in a single shared library (for PowerMac) or
68k Extension. The latest version of OLE has been broken out into constituent libraries
which contain related functionality, one of which is the Microsoft Component Library
which supports Mac ActiveX controls. This factored version of COM/OLE interacts
more efficiently with Apple's Code Fragment Manager, performance is improved and
less code is mapped into memory on launching an OLE application.
The latest version of COM, included in the Mac ActiveX SDK, has been optimized for
lightweight, high-performance, in-process objects such as ActiveX controls. New
API's make it easier for applications or controls to exploit the Alias Manager and work
within the Mac-specific runtime world to deliver compelling Macintosh solutions.
ActiveX controls require the use of the new Microsoft Component Library and are not
compatible with OLE 2.0x.
SDK Contents Overview
The ActiveX SDK for Macintosh consists of three separate, downloadable archives
available at: http://www.microsoft.com/intdev/sdk/mac/mactivex.html
ActiveX SDK (SDK_sea.hqx, ~2.5 MB) -- SDK, including sample controls and
containers, projects, source, headers, COM libraries, and ActiveX plug-in adapter.
ActiveX Runtime (Runtime_sea.hqx, ~6000k) -- binary files needed to run ActiveX
controls in commercial containers such as Internet Explorer and Netscape Navigator.
(Note: this archive contains the 'MS IE ActiveX Lib (PPC)' library required to use
ActiveX controls in versions of Internet Explorer later than 3.0b1. If you are using
3.0b1 or earlier, the ActiveX SDK archive listed above contains all the runtime
binaries required and you can skip this download.)
ActiveX Documents (Documents_sea.hqx, ~600k) -- documentation describing how to
create and run ActiveX controls on Macintosh. It contains the ActiveX User & Technical
Guides, as well as documents covering more advanced ActiveX topics such as
asynchronous monikers and code download. This archive also includes an introduction
to COM and a Component Object Model technical overview/specification.
Note that the Beta3 release of the Mac ActiveX SDK is currently being finalized and
will be available by the time this article is printed. Beta3 will be fully compatible
with Metrowerks CodeWarrior 11. There will be a document in the SDK correcting any
information presented here which needs revision in order to build and run the Beta3
samples. The Beta2 release is fully compatible with Metrowerks CodeWarrior 10.
The ActiveX for Macintosh SDK
General Overview
The ActiveX SDK for Macintosh includes:
1. Microsoft Component Library & ActiveX Plugin.
2. Sample Controls.
3. Sample Containers.
4. Source, headers, GUIDs, and other supporting files.
5. Utilities.
The Microsoft Component Library includes the most important elements of the Component Object Model, managing object instantiation, the Registry and essential
COM structures. This library can be used to build other, custom interfaces. The
ActiveX interfaces are built on this library and do not require the OLE 2.0x libraries.
The ActiveX Plug-in permits the use of ActiveX controls in browsers that support
Netscape Navigator-compatible plug-in technology.
The Microsoft Component Library was named comi2.ppc.ret in previous beta releases
of the Mac ActiveX SDK. You should throw away any copies of this file which exist on
your system before using the latest version of the SDK.
The SDK Sample Controls include samples demonstrating basic features of Mac
ActiveX controls including property retrieval, data streaming, event handling,
drawing, popup menus, dialogs, outgoing custom interfaces, and more. These samples
have been designed to easily serve as the basis for writing your own controls.
Metrowerks CodeWarrior version 10 or later is required for building all Macintosh
ActiveX controls.
The Mac ActiveX SDK ships with several Sample Containers which provide a simple
environment for testing individual controls, including a Metrowerks
PowerPlant-based container that extends PowerPlant document and view classes to
host controls.