Teach Yourself ActiveX in 21 Days

Previous Page TOC Next Page



– 1


Programming for the Internet


ActiveX is not the first method designed for programming over a network, but it is the first culmination of many diverse, prior-existing technologies for programming over intranet and Internet networks.

In this chapter you will learn to recognize the basic features of a hypertext document, as well as how to receive background information about ActiveX and Internet programming, including

Internet programming, or ActiveX, has advanced significantly due to the Microsoft-led initiative to implement the most effective processes for cross-network development.

Windows—The Most Widely Used Desktop Operating System


In its quest to provide a computer environment that would draw new users (as well as users of other operating systems), Microsoft introduced Windows 95 in late 1995. This latest version integrates technologies and interfaces exposed by competing operating systems. Microsoft hoped to draw in users of those systems by incorporating the speed, graphics and other interfaces from more successful operating systems such as Macintosh, Atari, Amiga and Commodore. By making the look and feel of Windows simple and intuitive, Microsoft hoped to also draw in folks who had never used a PC before.

When Windows 95 was in its developmental test phases (alpha and beta releases), the Internet was taking off like a rocket. The Net had been around for dozens of years, but it was not until about the time of Windows 95's release that it had become a household word. For some households (and businesses), it came as America Online, CompuServe, Prodigy, or a few local BBS systems. Others, sometimes without knowing it, used the Internet by way of a leased line, usually a frame-relay or ISDN over their office or school LAN (Local Area Network).

As Microsoft developed Windows, it could not ignore the burgeoning use of their operating system on networked computers. In acknowledgment of this, Windows 95 includes support for a wide variety of networks. By default, Windows installs itself as a client for both a Windows (such as NT) and a Netware network. This is occurring as Netware networks are being phased out in many OFFICE LAN's.

Dial-Up Networking


Many Internet users are connected through independent Internet service providers, or ISPs (such as CompuTek Network and FishNet). Many more users are connected through dial-up accounts with information tollways. Either way, the connection is probably made through a dial-up connection over regular phone lines.

The main difference between ISPs and tollways is pricing. ISPs tend to charge a flat monthly rate (around $10 to $30 per month, depending on your calling area), and tollways usually want $2 to $10 or more for every hour online. Another difference is that ISPs don't generally provide much content or tech support, whereas tollways focus on these services. For most developers, an account with an ISP is the way to go.

To keep their foot in the door, Microsoft provides a hybrid of ISPs and tollways called MSN (The Microsoft Network). MSN acts, for the most part, as a content provider. If you can't access MSN from the Net (via another dial-up provider), they offer several levels of metered hourly usage and charge a couple of bucks per hour for it—but it gives you an Internet connection when no others are available.


Installing MSN

Windows 95 ships with the everything you need to connect to the Internet. If you don't already have the MSN connection on your desktop, take this opportunity to install it.
MSN is both an ISP and a content provider. If you have an Internet account with another provider, skip this section. MSN costs about $5 per month if you don't use it for dial-up access. If you don't have a dial-up connection to the Internet, MSN does the trick, but the fee goes up to a couple of dollars every hour you're online. Figure 1.1 presents you with the setup screen for installing MSN; to install MSN, follow these steps:
Step 1—From the Control Panel, click the Add/Remove Programs icon.
Step 2—From the Windows Setup tab, select Communications and press the Details command button. This displays a list of communications accessories that you can install.
Step 3—Make sure that Dial-Up Networking and Hyperterminal are selected, then press the OK command button to return to the Windows Setup tab. The Dial-Up Networking component allows you to make any of several different types of network connections, including and especially a PPP (Point-to-Point Protocol) connection to the Internet. Hyperterminal allows you to make telnet-like dial-up connections to local BBS and UNIX shell providers.
Step 4—Scroll down the list and select Microsoft Exchange, then press the Details command button to display a list of Microsoft Exchange programs that can be installed from the Windows95 Setup disk(s).
Step 5—Make sure that Microsoft Exchange is selected. Do not select Microsoft Mail Services unless you already know that you are using Microsoft Mail. Microsoft Mail is not Internet Mail. Press the OK command button to return to the Windows Setup tab.
Step 6—Scroll down the list and select The Microsoft Network, then press the OK command button to return to the Windows Setup tab for the last time.
Step 7—Finally, press the OK command button on the Add/Remove Programs window. Windows will prompt you for disks (unless your Win95 CD-ROM or diskettes have remained in the same place as when you installed Windows). When the installation process is complete, you will be prompted to reboot your machine.
Step 8—Launch the white MSN icon that is now on your desktop (see Figure 1.1) and follow the prompts for logging on to the Internet .

Figure 1.1. Windows setup allows you to install MSN , or another service, as your default Internet provider.


Warning

Most online services require that you provide a valid checking or credit card account number. This is like giving your account number to a cashier at an unfamiliar shop, so always monitor the activity on any accounts used—be it over the Internet or elsewhere. This protects you from overcharges (these systems aren't perfect!) as well as from outright theft.


Most folks first getting a dial-up connection do so through one of the information tollways. In response to this opening in the market, Microsoft has developed MSN (The Microsoft Network). One option in Windows 95's setup process allows you to place a connection to MSN on your desktop—putting it and the Internet just a click away.

Placing the MSN icon on the Windows 95 desktop consummated the marriage of the ordinary user's computer with the Internet. This marriage placed an immediate demand on programmers to develop applications that used the distributed nature of the Internet—the ability to transmit information back and forth over wide distances and in real-time. Business owners want to use the Internet to give their business a wide presence on the Internet.

On previous networks, users could share documents and directories of documents, but this was limited primarily to use on LANs. This was because most technologies, such as file sharing, were only mature on LANs, not WANs. The technology was there—it just had not yet been implemented.

Integration of Network Technologies


That's when Microsoft took the ball and ran with it. To maintain dominance in the computer industry, they needed to develop applications that would allow the greatest percentage of the market to use the Internet with Windows. The task became complicated because there were many diverse entities working on the standards under which the Internet would operate.

Figure 1.2. Many different organizations are involved in defining the standards for the Internet .

Organizations, such as IETF (Internet Engineering Task Force), The World-Wide-Web Consortium (W3C), Xerox PARC, France's CERN, NCSA (National Center for Supercomputing Applications), EFF (Electronic Frontier Foundation), and many others each took one or a few intranet computing concepts and developed methods and protocols to support those ideas on different systems (see Figure 1.2). These converted methods and protocols allow for file transfers, e-mail, conferencing, and news broadcasts to occur on the Net without interfering with each other, and ensure the delivery of the proper message packets to the intended recipients.

Microsoft has placed their own people on the boards of many of these bodies to ensure the representation of Windows technologies in the ongoing task of allowing cross-platform use of the Internet, and to ensure that Microsoft's products conform to any adopted standards.

The Release of ActiveX


Now that the marriage of Windows and the Internet is complete, Microsoft is turning their network programming technologies over to the public domain. This will allow people to write applications for use on the Internet, and will bring more non-users into the fold of Windows computing.

These technologies are collectively referred to as ActiveX, reflecting Bill Gates' directive to his developmental staff to "Activate the Internet."


Installing the ActiveX Software Developers Kit

Before you go any further, install the ActiveX SDK on your local hard drive. You can find this tool kit, which is central to this book, on the enclosed CD-ROM. Installation is really quite simple:
Step 1—Locate the ActiveX.exe" file on the enclosed CD-ROM.
Step 2—Double-click this file and accept its installation defaults when prompted.
Step 3—Reboot the system when prompted.
Step 4—Review the directory in which the file was installed (usually \INetSDK\). Notice which files ActiveX.exe placed in that directory. You will be using these files throughout this book.

ActiveX gives the programmer the ability to enable a program to access files and messages (and even access actual people) over the Internet—and to be able to market that program to a very wide audience. This means that a user can acquire an inexpensive custom program for a specific purpose from darn near anywhere. This is because even the most inexperienced programmers will have the tools to write applications that can manipulate data over a network right at their fingertips.


Hint

The demand for simple Web browsers and e-mail programs has peaked—everybody needs them. You probably won't be creating these basic utilities, because anybody can get them free from Microsoft!
ActiveX gives you the tools to provide what the market really wants: customized, specialized products created for specific purposes. You will need to identify special demands that cannot be met by standard Internet utilities.


Document Objects


One of the paradigm shifts effected by Microsoft's input in network standards involves the idea of documents as enhanced objects .

In earlier operating systems, the whole focus of programming was limited by the capabilities of the user's computer. For instance, a programmer who writes a really great paint program has to first determine whether the end-user's machine will have the graphics resources (hardware, firmware, software, and so on) to run the application.

Instead of asking "what is the user's computer capable of doing," ActiveX programmers ask "what does the user want to do?" (A very happy question!) This compelled Microsoft to adopt the slogan "Where do you want to go today?"

Certain classes define the different types of objects supported by a given computer system. The classes define what properties, methods and events are supported for an object. They also define how an object is to be implemented on the local machine. These defined objects are instantiated (created), then uninstantiated (thrown away) as needed by a program.

The Frankenstein Model

Let's take this idea to its wildest extreme: You are a mad scientist and you are going to create an object called objFrankenstein. To make it, you must have a specification (or class) for creating it. This specification defines objFrankenstein's properties, methods, and events.

objFrankenstein will have properties, such as a brain called objFrankenstein.Brain and a torso called objFrankenstein.Torso. Some of these properties will be property arrays, such as objFrankenstein.Eyes(Left) and objFrankenstein.Eyes(Right).

objFrankenstein will also have events that occur based on changes in a property. He might have an event called objFrankenstein_WakeUp that fires whenever he wakes up, or an event called objFrankenstein.Eyes(Left)_Wink that fires whenever he winks his left eye.

objFrankenstein's methods define how he does things. An example would be his method for sitting down. When he sits, he might use a method like following, which is coded in VBScript (with some imaginary objects, properties, methods and events):




objFrankenstein_Sit(Chair as Furniture, Distance as Height)



Select Case Chair



 Case "Bean Bag"



 objFrankenstein.move "Down" "Distance"



 Case "Couch"



 objFrankenstein.move "Down" "Distance"



 Case "Unknown"



 objFrankenstein.Look "Behind" "You"



End Select

Figure 1.3. By treating a document as a customizable bag of properties, OLE programmers can create almost anything within that document.

All of this is defined in the class specification for the object(s) (see Figure 1.3). In ActiveX, the methods for defining these classes on a computer are expanded to consider the distributed nature of the Internet. This gives your Frankenstein object certain advanced features, such as privacy and the capability to re-create modified versions of itself from information available at a remote location. Pretty wild, eh?

The Document Object

ActiveX technologies reference each document on the Internet as an object. By document, I mean an item that exists somewhere on the Net and can be transferred to another machine. This document object could be a whole program that runs on a user's machine, or a spreadsheet table, or even a word-processing document, such as a resume or a business plan. Whatever the object, it is is considered an Internet document for viewing purposes.

In turn, these document objects have their own properties, methods and events. Some of the properties of the document can include Document.Page(), Document.Title, and Document.Author. Some of the events of the document can include Document_OnLoad and Document_OnUnload. Some of the methods can include Document.Save and Document.Delete.

Figure 1.4. Documents may just be a string of text, but if the text is formatted correctly, properties of that content can be retrieved.

This redefinition of the document compelled the development of several related technologies. The OLE controls used by programmers of standalone systems were enhanced or redesigned (see Figure 1.4), which necessitated the implementation of cryptographic and other security features. Data download services were implemented to enable users who wanted to view a document that their system was incapable of manipulating to download controls as needed. Scripting services have also been redesigned to take advantage of document automation processes.

Hypertext


In and of itself, the sharing of documents over the Net is only mildly interesting. However, in the last five years, hypertext documents have become very popular—and rightly so (see Figure 1.5). Hypertext is a way of formatting various forms of content through the Net so that users can interact with the content regardless of the type of computer they are using. Therefore, Mac, UNIX, and Windows users can each access, interact with, and update the same information. The most common type of content that can be shared in this way is called multimedia.

Figure 1.5. A hypertext document viewed in Netscape .

The standard format for transferring this multimedia data over the Net is referred to as MIME (Multimedia Internet Mail Extensions). The entire MIME specification is contained in RFCs (Request For Comment) 1521 (http://ds.internic.net/rfc/rfc1521.txt) and 1522 (http://ds.internic.net/rfc/rfc1522.txt). Basically, this specification defines how computers on the Internet share nontext information, such as video and sound clips. These RFC pages are the first and second halves of the MIME standard for identification and dissemination of multimedia content over the Internet.

When someone says "I'm surfing the Net" or "I'm cruising the Web," he is usually referring to viewing hypertext documents. Hypertext documents exist on a remote server system, such as NASA's, the Louvre's or the Library of Congress's. The documents can then be viewed with a Web browser, such as MSIE (Microsoft Internet Explorer) or Netscape Navigator.

These powerful document viewers allow for content like you will never see in a traditional newspaper. Instead of simple inline graphics for a news story or advertisement, content providers place inline audio and video on their pages. Also, features such as command buttons and scrolling lists allow the user to enter data (such as a name, address and credit card info) into the page. This user input might either be some sort of request for, or submission of, information.

The hypertext specification is the definition of how these documents are put together. Remembering that a document is nothing more than text strung together, the specification does not define what content is found in a document. Rather, it specifies how that content is formatted. For a full description of the hypertext specification, visit Microsoft's Internet Development site (http://www.microsoft.com/intdev), the IETF (http://www.ietf.org), or the Internet Network Information Center (http://www.internic.net) .

Summary


In this chapter, you have become familiar with Microsoft's drive to integrate the diverse Internet technologies into a cohesive family of commercial-grade processes for information sharing. You also have been exposed to MSN, one of the information tollways. These new products and services add value to dial-up computing as well as leased-line services, such as corporations and research institutions.

You are now also aware of the paradigm shift involved in the ActiveX integration, which involves a change from computer-oriented to document-oriented programming. Document-oriented programming allows each document to have properties, methods and events within which programmers may code their programs. You have also been exposed briefly to the basics of hypertext documents.

Q&A



Workshop


Referring to the documentation provided with the ActiveX SDK and available at their Web site, notice the standards that have been developed outside of Microsoft (such as PICS, MIME and HTML 3.2). Review and bookmark these sites. You can add a shortcut to your desktop instead of bookmarking it by selecting File|Create Shortcut from the Internet Explorer menu bar.

Quiz



Note

Refer to the Appendix, "Answers to Quiz Questions," for the answers to these questions.

  1. What is an information tollway?

  2. What two different components of Windows 95 can be used to access network services over a modem?

  3. Why did Microsoft create ActiveX?

  4. What conceptual shift is reflected in the ActiveX document objects features?

  5. What defines an object's properties, methods and events?

  6. What are objects composed of?

  7. Why is HTML such a popular presentation format?

  8. What format allow multimedia content, such as audio and video, to be transmitted via the Internet?

Previous Page Page Top TOC Next Page