Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

Activex Developer's Resource

Activex Developer's Resource

by Kamran Husain, Jason Levitt
Become an expert ActiveX™ developer--fast.

If you're an experienced programmer, ActiveX Developer's Resource brings together everything you need to become an ActiveX expert.

You'll review the fundamental concepts underlying ActiveX, and learn how controls and container documents work together. You


Become an expert ActiveX™ developer--fast.

If you're an experienced programmer, ActiveX Developer's Resource brings together everything you need to become an ActiveX expert.

You'll review the fundamental concepts underlying ActiveX, and learn how controls and container documents work together. You'll walk through the process of developing--and using--ActiveX controls. You'll discover when (and when not) to use each of these powerful ActiveX development tools:

  • Visual Basic™ 5.0 Control Creation Edition (CCE)

  • The Visual C++® 4.2 ActiveX Software Development Kit (SDK)

  • The ActiveX Template Libraries (ATL)

  • The ActiveX Control Pad and Script Wizard

  • The Visual InterDev Toolkit for Office 97

ActiveX Developer's Resource shows how to make your Net-based ActiveX controls as secure and efficient as possible. You'll find practical ActiveX techniques for both server-side and client-side Internet applications, and discover the best ways to integrate your controls with Microsoft®'s Internet Explorer browser (version 3.01 or later).

You'll learn how to use VBScript to direct ActiveX controls connected to HTML pages--and how to create Active Pages that deliver information from your corporate databases. There's also detailed coverage of server extensions, in-process servers, and other advanced client/server Web programming issues.

The accompanying CD-ROM includes all you need to jumpstart your ActiveX development: example controls, extensive Visual C++ and Visual Basic source code, HTML and Active Server Pages, a sample Access® database, and much more.

Don't wait another day to start learning ActiveX. Get ActiveX Developer's Resource--and get results.

Product Details

Prentice Hall Professional Technical Reference
Publication date:
Prentice Hall Ptr Developer's Resource Series
Edition description:
Book and CD
Product dimensions:
7.05(w) x 9.26(h) x 1.42(d)

Read an Excerpt

PREFACE: Welcome to Activex Developer's Resource, a book written for programmers who want to use and develop Activex controls to enhance their applications. Reading through this book you'll find that it goes beyond developing Activex controls with various Microsoft tools; it also covers writing applications with Activex controls.

If you are like most computer programmers, you write application programs to solve problems. Activex programming involves writing reusable bits of code with which you can create your own programming applications. This book will show you some of the tools available to make your Activex programming job easier.

As you develop and use Activex controls, you will see that their use is not restricted to the Internet. They can also be used in local applications just like OLE controls were. In fact, Activex controls are what used to be OLE controls, but without excess code.

How you use an Activex control is just as important as designing the control itself. For example, when designing your own Activex control, you have several options. You can use the Activex Software Development Kit (SDK) with Visual C++, version 4.2, to write your control and to use the Microsoft Foundation Classes. This choice will lead to a rather large Activex binary file that may take a long time to download via a network. However, the advantage is a quicker design and development cycle with the ability to use a lot of existing libraries.

If you want to use only some of the features of Activex controls and are concerned about sizes of binary files (so as to limit the time required to download them on a slow network) you could consider the use of theActivex Template Libraries (ATL) to build a leaner control. The ATL method will produce smaller binary files, but is complicated to implement for all but the simplest of Activex controls.

Yet another alternative is to use the Visual Basic, version 5.0, Control Creation Environment (CCE) and the wonderful new features that it offers (although your broswer may have to download an additional Dynamic Link Library (DLL) or two depending on what functionality you incorporate). If you don't intend to have your Activex control downloaded over the Internet and don't have extensive graphics, you can even use Visual Basic, version 4.0, to create an in-process server application.

Do you see the number of choices available to you? Basically, if you know what's best suited for a particular design environment, you can elect to use the best tool available. Think of the possibilities! This is precisely what is offered in this book: examples of how to use development tools and environments, along with explanations of the strong points and the gotchas with each method. You should be able to read through each chapter and see how a specific tool was applied to solve a particular problem

The book assumes that you have a prior working knowledge of writing HTML pages, programming in C++ or Visual Basic, or both. Each chapter covers the use of tools and, when necessary, provides sample screen shots, along with explanations to give you a feel for what to expect when using the particular environment. What You Will Need

This book was written and tested with Microsoft Internet Explorer, version 3.01 and later, and will not work with earlier versions. This code will not work with Internet Explorer, version 2.X, nor with version 3.00. You MUST upgrade to a version 3.01 or later. This code will not work with any version of Netscape Navigator.

The Target System and Development Environment

The development environment for this book is intended for use in Windows 95 and Windows NT 4.0. The code samples here will not run properly in Window 3.1 or any flavor of Windows NT 3.51. The present development environments from Microsoft, for better or worse, lock you into this environment. Development Kits

Here are the development kits that you must have to work with the samples in this book:

  • Visual C++, version 4.2 or later. Do not attempt to get the code to work with Visual C++, version 4.1 or earlier.
  • Microsoft Internet Explorer, version 3.01 or later. Be sure to install Internet Explorer before you install the Visual C++ compiler and the SDK. The MFC*.DLL files do not work right if the process is reversed.
  • Latest Activex SDK that is available from the Web site www.microsoft.com. The samples in this book worked with the base version with Visual C++, version 4.2 without any problems.
  • Visual Basic, version 4.0. If you are not up to 4.0 yet, please pgrade your Visual Basic version now, and you will thank yourself later.
  • Visual Basic, version 5.0 CCE. At the time this book was written, this version was still in Beta mode.
  • Activex Control Pad. This was also in Beta at the time this book went to press (and may not be as stable you might think). You can download the latest version from the Microsoft site.
  • Visual InterDev Toolkit for use with Office 97 applications. Again, was still in Beta, but will still prove to be a valuable tool for you in developing your own Web Applications.

    Topics This Book Will Cover

    The sample controls and example applications presented in this book will cover both the steps required to develop your own control as well as the use of these Activex controls. By the time you have read the entire book, you will have covered the use of Visual Basic, version 4.0, Visual Basic, version 5.0 CCE, Activex SDK for Visual C++, version 4.2 or later, VBScript, the use of the Activex Control Pad, Database interfaces, using direct connections to the Internet, ISAPI extensions and whether or not to use the Activex Template Libraries.

    Sounds like a lot of ground to cover, doesn't it? The primary reason for this broad range of topics is to provide you with the knowledge of how to apply a tool to solve your specific problem when designing an application that uses Activex technology. After you have read the book, you should be able to assess the requirements of your particular application and be able to determine what tool to use where. Also, you should be comfortable enough with each tool to be able to see how to get the results you want. Part One

    Chapters 1 through 4 deal with developing Activex controls and Container applications that use these controls. These chapters cover the use and development related to local applications only and do not cover the use of networking features in COM. That is, the focus of Part One is based on applications that work on a local machine only even though the controls you develop can be used on the Internet. Part One also deals with the development details of using two different types of toolkits to develop Activex controls: Visual Basic 5.0 CCE and Visual C++.

    Part Two

    The second part extends the information to the use of Activex controls to client side use in World Wide Web applications. Chapter 5 is dedicated to introducing the VBScript language that can be used to control the operations of Activex controls in HTML documents. Chapter 6 introduces the use of the Activex Control Pad to develop HTML documents and the use of a Script Wizard in the Control Pad to add VBScript to the HTML controls on that page. Chapter 7 deals with using the Internet Explorer effectively with Activex controls.

    Part Three

    In Part Three, you'll find out about how applications on the server side use of Activex controls and VBScript, with the focus on accessing information in databases to create active pages. The examples in these chapters are intended to provide guidelines of how you can apply Activex, VBScript and the IIS technology to develop your own Web pages. This section covers methods involved in securely getting an Activex control from a server to a client with the use of Cabinet files and INF files.

    Part Four

    Part Four provides information on specific issues such as the use of server extensions and databases with Activex technology, direct access to the Internet, in-process servers and also with the use of interfaces with Activex controls. These chapters will cover advanced programming issues that you are likely to deal with when trying to develop client-server applications.


    The README file provided on the CD-ROM contains all the information about the source code used in this book. Please be sure and read it. Additionally the CD contains students.mdb (a sample Access database for you to use with the sample HTML, HTX and IDC files) and myeqsrc.zip (a sample control with all the fixins). Here are some of the extensions used in the source files:
  • .HTM or .HTML for (HTML )
  • .IDC, .HTX and .ASP for (Active Server Pages)
  • .CPP, .HPP, etc. (Visual C++)
  • .BAS and .CLS for (Visual Basic)
  • .MDB (Access database)

    There are several things you should know about before you attempt to use these files. It will be very beneficial for you to create your own Visual C++ or Visual Basic projects and cut/paste the modifications to those files. Most of the class IDs, path names, included files, etc. in the files on the CD are suited towards my particular machine and installation. Your installation of Visual Basic, Visual C++, etc. will most certainly be different than mine. By creating your own sample projects, you can ensure that the code will be best suited to your machine, contain the right Class IDs, path names, etc. The whole idea of using tools is to minimize the amount of typing that you do. Most of the code and underlying framework will be generated by the Class Wizards or the Visual Basic environment. The modifications you make will be minimal at best, not more than one or two pages. In most cases, you will be adding in one or two lines of code only. Check the code in chapters 5 through 8 and you will see what I mean. Most of the VB code is five lines or less. Of course, the longer listings are included in the source directory tree for you to work with. You will save some typing time by using these provided HTML files to test with.

    You can cut and paste specific sections of the provided code into your own project file. Actually, by typing in the code for each chapter's listing yourself, you will be able to make your own modifications and customize it your needs. By typing the code in specific sections of the generated source files, you will be in a better position to see how the examples work instead of taking the code for face value. The files are loosely named based on their occurrence in the text for the chapter itself. For example, 11ch04.cpp would be Listing 11.4 in the book. If there is no listing number in the text, the file contains an excerpt or the code for a function in the text. The reason for putting only the code for the function or subroutine is to allow you to easily pinpoint the changes you have to make in your own project. You should be able to literally insert the requisite code into your own project. Consider the changes that you have to make to create a control with the CCE. It is very important that you download and install the CCE from www.microsoft.com before you attempt to use the VB files. If you do not install the VB5 CCE, your system will not have the necessary DLLs and links to files that are required to create a control.

    Finally, the host names and machine IDs used in the code in the sample files are fictitious. They were created for use on an Intranet and will not necessarily be available from the Internet. You should modify the host names and addresses to valid, reachable values before using the sample code. Conventions Used

    Throughout the book you will notice different elements employed to help make the text easy to read and consistent from start to finish.


    Any time you run into source code it will appear in a special font to set it apart from the flow of text like this:

    Activex Developer's Resource, the book for you Also, within the text you'll occasionally notice some items formatted in this same font. These are extracted portions of code. Still, other times you will see some code samples that contain statements in bold face type. These statements are what you are supposed to type in as you read a particular section of code. Some changes to code will be incremental so the source files you see on the CD-ROM at the back of the book may not match what you see in the middle of the text.

    However, in almost all cases, the Application Wizards that you work will generate the bulk of the code for you. You will find it more beneficial to type in the modifications to these listings yourself rather than use the sources files verbatim. The most important reason for adding your own code is that it will familiarize you with the workings of the controls and applications presented here and you make your custom changes. Icons

    The following icons are used to help draw your attention to topics that might otherwise be lost in the body of text.

    This icon is used to point out particularly useful information that will save the reader time, highlight a valuable technique, or offer specific advice. This icon flags information that deserves special attention, such as an interesting fact about the topic at hand, or something that the reader may want to keep in mind while programming. This icon is used to draw your attention to information that, while useful, may cause unexpected results or serious frustration.

    This icon alerts readers to software bugs and possible methods of avoiding them. The Personal Motivation Factor Finally, my personal motivation for writing this book. As you read this book, you will see that it does not cover the whys of Activex controls. Rather the focus is on how to use controls. The approach taken by the book is that most readers will not want to know how the internal combustion engine and the transmission gears in their car works, but rather which pedals and levers to use to make the car go in a particular direction. Often in the course of events when dealing with irate, impatient, clients, I have had to wade through pages of irrelevant, detailed information in many books to find that one simple solution that will get the problem solved for my clients. More than once, the solution uncovered was not exactly what I wanted but offered enough clues for me to figure out what I really needed. Sadly, no one book can offer you the solution to every one of your questions. This book is not the panacea for your programming needs. What I hope that this book will provide will be the insight to see the solution, perhaps more, to your problem, and the information of how to implement it. At the very least, you should get enough information on where to look for more information.

    The sheer number of alternatives when looking at using and developing controls is confusing for a lot of folks, including myself. While developing the sample code for this book, and scaling down the complexity of existing tools that I have used in other consulting projects, I learned how to, and how not to, use these development tools. It is my sincere hope that I can convey some of this experience on to you. After having programmed in the UNIX and 16 bit windows world for years, I have written many Widgets and VBXes for use as building blocks for my applications. You can use the latest Activex technology to enhance your current consulting projects in the same manner as you would with Motif Widgets or VBXes. The OCX technology for use as building blocks in 32-bit applications is just a great way to put together applications. What's even better with Activex is the number of tools that are available to you as a programmer compared to what was available a few years ago. Enjoy developing and writing your new Activex control applications.

Customer Reviews

Average Review:

Post to your social network


Most Helpful Customer Reviews

See all customer reviews