TOC Next Page

Presenting ActiveX™

Warren Ernst

Sams.net Publishing

201 West 103rd Street, Indianapolis, Indiana 46290

To my mom—thanks for all your love and encouragement. We'll make it through life with a laugh and a smile.

—Warren Ernst

Copyright © 1996 by Sams.net Publishing

FIRST EDITION

All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. For information, address Sams.net Publishing, 201 W. 103rd St., Indianapolis, IN 46290.

International Standard Book Number: 1-57521-156-4

Library of Congress Catalog Card Number: 96-68942

99 — 98 — 97 — 96 ————————4 — 3 — 2 — 1

Interpretation of the printing code: the rightmost double-digit number is the year of the book's printing; the rightmost single-digit, the number of the book's printing. For example, a printing code of 96-1 shows that the first printing of the book occurred in 1996.

Printed in the United States of America

All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams.net Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. ActiveX is a trademark of Microsoft Corporation, Inc.

President, Sams Publishing:

Richard K. Swadley

Publishing Manager

Mark Taber

Managing Editor:

Cindy Morrow

Marketing Manager:

John Pierce

Assistant Marketing Manager:

Kristina Perry

Acquisitions Editor

Beverly Eppink

Software Development Specialist

Bob Correll

Production Editor

Lisa M. Lord

Indexer

Tom Dinse

Technical Reviewer

Dena Fleet

Editorial Coordinator

Bill Whitmer

Technical Edit Coordinator

Lynette Quinn

Resource Coordinator

Deborah Frisby

Formatter

Frank Sinclair

Editorial Assistants

Carol Ackerman
Andi Richter
Rhonda Tinch-Mize

Cover Designer

Tim Amrhein

Book Designer

Gary Adair

Copy Writer

Peter Fuller

Production Team Supervisor

Brad Chinn

Production

Mary Ann Abramson

Carol Bowers

Sonja Hart

Mike Henry

Paula Lowell

Overview

Introduction

Part I

Fundamentals of the Internet and ActiveX

1

Computers and the Internet Today

2

Microsoft's Vision of the Internet's Future

3

Internet Explorer 3.0: Microsoft's Gateway to the Internet's Future

Part II

Components of ActiveX

4

The Components of ActiveX

5

ActiveX Documents

6

ActiveX Controls

7

ActiveX Scripting

8

ActiveX Internet Information Server

Part III

Developing ActiveX Controls

9

ActiveX Controls and Visual Basic Script

10

Using the ActiveMovie Control

11

ActiveX DocObjects: Making Your Application Internet and Intranet Aware

12

Controlling the Internet Information Server Through ActiveX ISAPI Filters

13

Developing Web Applications Using ISAPI Extensions

Part IV

Issues and the Future of ActiveX

14

Applications of ActiveX

15

ActiveX Versus Java

16

ActiveX Goes to Nashville

Part V

Appendixes

A.

ActiveX Online Resources

B.

Glossary

C.

VBScript Syntax Quick Reference

D.

What's on the CD-ROM?

Index


NOTE

This book is based on a stable beta version of Internet Explorer 3.0 and Microsoft Visual Basic, Scripting Edition (also called VBScript). We've expended a lot of effort to ensure that it's as accurate as possible. However, if any discrepancies between the material covered here and the official product release of Internet Explorer 3.0 and VBScript come to light, they will be fully documented and available online.

Disclaimer from the Publisher

The information in this book is subject to the following disclaimers:

Acknowledgments

Even though there's just one name on the spine of this book, there were a lot of people who had a hand in creating it. Therefore, I'd like to take this space to give a hearty thanks to some of those people who helped in intangible ways.

First and foremost, the authors would like to thank Lisa Lord and Fran Hatton for their help in coordinating the many aspects of this book. Their expertise in putting together a book and keeping me on my deadlines made this book possible.

I would also like to thank Lisa Rivera for her continuing love and support while I spent the time writing this book instead of heading to the beach for a picnic.

Lead Author

Warren Ernst (wernst@cris.com, http://www.deltanet.com/users/wernst/) is a technical writer, computer trainer, Webmaster, graphic artist, and "general computing guru." Warren became involves with the computer industry in 1988, performing technical support and testing for Beagle Bros. Software, Smith Micro Software, Toshiba of America, Advanced Technology Center, and NASA's Jet Propulsion Labs, going on to write and design user manuals, online hypertext help systems, and Web pages for these companies and their products. He was a contributor to Sams.net's Netscape 2 Unleashed and is the author of Que's best-selling Using Netscape and Using Netscape in Windows 95. He is also the owner of a small computer-consulting firm, which specializes in training, hardware and software consultation, writing, and "keeping computers from ruining your life." He spends what remains of his spare time on collecting llama trinkets, full-size arcade games, and wasting time on his computers at home.

Contributing Authors

John J. Kottler has been programming for 14 years and has spent the past 6 years developing applications for the Windows platform; he has also been programming multimedia applications for over 2 years and has spent this past year developing for the Web. His knowledge includes C/C++, Visual Basic, Lotus Notes, PowerBuilder, messaging-enabled applications, multimedia and digital video production, and Internet Web page development. In the past, he has published numerous articles in a computer magazine, writing original programs and instructing developers on programming techniques. John has also been recently published in Sams.net's Web Publishing Unleashed and Netscape 2 Unleashed and Sams Publishing's Programming Windows 95 Unleashed. He was also a co-developer of the shareware application Virtual Monitors. A graduate of Rutgers University with a degree in computer science, he enjoys roller-blading, cycling, or playing digital music in his spare time. John may currently be reached at the following e-mail addresses: 73157.335@compuserve.com, jkottler@aol.com, or jay_kottler@msn.com.

Michael Morrison is the author of Teach Yourself Internet Game Programming with Java in 21 Days, a contributing author of Tricks of the Java Programming Gurus and Java Unleashed, and the co-author of Windows 95 Game Developer's Guide Using the Game SDK. He currently lives in Scottsdale, Arizona with his much better half, Mahsheed. When not killing time on the Web, Michael enjoys adding to his vast collection of cuts and bruises by skateboarding and mountain biking. You can contact Michael on Compuserve at 74037,3444 (74037.3444@compuserve.com).

Kevin Walsh is a development manager for workgroup document management software at Intergraph Corporation in Huntsville, Alabama. Kevin has been knocking around on computers since he started as a keypunch operator and control panel wirer for EAM equipment in 1976, while in the service of the U.S. Navy. He has worked in a variety of capacities, including journeyman programmer, custom development consultant, software product marketing, and project lead architect.

Daniel Wygant (dfwygant@ingr.com) is a Senior Software Analyst with Intergraph Corporation in Huntsville, Alabama, where he has been employed for nearly 12 years. He received his B.S. in Pure Mathematics from Florida State University. His development experience includes UNIX, Windows NT, and Windows 95. Daniel is currently involved with the OLE Data Server for CAD formats. His interests include OLE and Internet programming, such as ActiveX DocObjects, ActiveX controls, ISAPI extensions, and ISAPI filters. His publications include articles in Windows NT magazine.

Keith Brophy and Timothy Koets wrote the VBScript appendix. Keith is currently Software Release Coordinator for X-Rite, Incorporated, a leading worldwide provider of Color and Appearance quality control software and instrumentation in Grandville, Michigan. Timothy is a software engineer at X-Rite.

Tell Us What You Think!

As a reader, you are the most important critic and commentator of our books. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way. You can help us make strong books that meet your needs and give you the computer guidance you require.

Do you have access to CompuServe or the World Wide Web? Then check out our CompuServe forum by typing GO SAMS at any prompt. If you prefer the World Wide Web, check out our site at http://www.mcp.com.


NOTE

If you have a technical question about this book, call the technical support line at (800) 571-5840, ext. 3668.

As the team leader of the group that created this book, I welcome your comments. You can fax, e-mail, or write me directly to let me know what you did or didn't like about this book—as well as what we can do to make our books stronger. Here's the information:

FAX: 317/581-4669

E-mail: newtech_mgr@sams.mcp.com

Mail: Mark Taber
Comments Department
Sams Publishing
201 W. 103rd Street
Indianapolis, IN 46290

Introduction

by Warren Ernst

The Internet, as it exists today, is a great tool for searching for existing information, regardless of where in the world it's actually located. Business applications currently excel at giving users tools for creating new information from scratch. Very rarely will you find "hybrid" programs that are capable of both generating new information and communicating via the Internet, mostly because the tools that make creating such programs weren't widely available or powerful enough to make a "no-holds barred" program truly useful. Microsoft has plans to change this division of programs, and it's called ActiveX.

ActiveX is the name of a group of software technologies and methods that promise to make it easy to create "traditional business applications" with powerful Internet connectivity and "traditional Internet communications programs" with true computational power. Building on the OLE (Object Linking and Embedding) technology that has been available for some time, ActiveX essentially expands the realm of "object sharing" from merely the desktop to the whole Internet, making this new class of program possible. Since ActiveX technology is modular in design, programs can be written in such a way that they can work as standalone applications, embedded "smart" objects within Visual Basic programs or Web pages, or as traditional OLE objects within business documents, all with the potential to communicate with the Internet, should you choose.

As ActiveX gains wider acceptance, the Internet will find itself changing from merely a wellspring of static information "pages" to a source of working programs that manipulate, display, change, or create new information or data. Communication with others through the Internet will occur within our word processors, spreadsheets, drawing progams, and so forth, without having to switch to dedicated browsers or Internet programs.

Or at least, that's the theory.

Being a very new technology, ActiveX has yet to take the Internet world by storm and change it overnight. But from the ActiveX technologies that have been exploited, it looks like Microsoft's vision of tomorrow's Internet might not be too far off. That's what this book, Presenting ActiveX, hopes to help you accomplish: to explore the possibilities ActiveX makes available to software developers.

As an introduction to ActiveX, this book will benefit the following people:

How to Use This Book

This book is an introduction to the basics of ActiveX: how it's similar to and different from Java technologies, how to "run" ActiveX programs and modules, how ActiveX works with and without the Internet, and what the basics are of constructing ActiveX technologies. This book is organized so that users with a wide range of technical backgrounds leave with a better understanding of what ActiveX really is.

The Scope of This Book

This book discusses the significance of ActiveX and the impact it will have on the Internet and programming in general. It gives you an overview of the Microsoft Internet Explorer 3.0 Web browser, including where to get it from the Internet and how to install it to begin using ActiveX technologies. It then surveys the main features of the different aspects of ActiveX in "plain English," with plenty of examples, screen shots, diagrams, and a minimum of actual code and technical jargon. Next, the book reviews the procedures and methods for creating your own ActiveX modules with Visual Basic and Visual C++. Finally, it covers some of the exiting future issues of using ActiveX.

Presenting ActiveX is not meant to be a comprehensive programming guide or complete reference of ActiveX—in fact, Microsoft makes that sort of material publicly available in the ActiveX Software Development Kit CD-ROM. Instead, this book provides a quick start for project planners, software developers, and Webmasters, complete with introductory material plus basic programming examples and code samples. Pointers to current material on the Internet about these subjects are also supplied where appropriate.

Finally, this book is based on the ActiveX Software Development Kit as it was available during the early summer of 1996, so if some time has passed since then, some aspects might be out of date or somewhat changed to reflect actual usage. The Microsoft home page at http://www.microsoft.com/ should be consulted occasionally to review new developments with ActiveX and to download new portions of the ActiveX SDK.

How This Book Is Organized

This book is divided into five parts (the fifth includes four appendixes), each of which contains three to five chapters. Each part is intended to approach ActiveX from different perspectives, so although some material might overlap from part to part, each will have a different "slant."

Part I, "Fundamentals of the Internet and ActiveX," is an overview of the Internet and the role ActiveX can play within it. These chapters explore the current deficiencies of the Internet in transmitting information that isn't static and unchanging, how the Internet can support new technology, and how to use Internet Explorer 3.0 to start using ActiveX today.

Part II, "Components of ActiveX," defines and explains the available portions of the family of ActiveX technologies. Each chapter takes a single ActiveX technology, explains how it's similar to or different from existing technology, reviews how it's used and created, and presents examples you can experience.

Part III, "Developing ActiveX Controls," takes you a step further than Part II by actively taking you through the process of creating different ActiveX modules, including scripting, precompiled modules, and Web server enhancements.

Part IV, "Issues and the Future of ActiveX," reviews some of the potential pitfalls and working solutions to using ActiveX, compares these issues to those associated with Java-based technologies, and explores how ActiveX will be incorporated into the next version of Windows NT.

The appendixes review the online ActiveX resources available on the Internet, presents a glossary of terms, offers a quick reference to VBScript syntax, and details what is on the book's CD-ROM.

TOC Next Page