This developer's guide is designed to show you how to design, develop, and deploy applications that use messaging, telephony, and speech services available within the Windows 95 operating system. The primary focus is on developing client-side applications. Several chapters in this book cover the server-side aspects of these APIs, too. However, the emphasis is on the client or desktop.
Note |
The primary focus of this book is Windows 95, and all examples are therefore in 32 bits. The same examples will work for Windows NT. The ideas can be applied to 16-bit Win31, but no 16-bit examples are given in this book. |
One book cannot begin to cover all the possible development tools and API sets that provide message, telephony, and speech services for desktop pcs. The approach taken here is to concentrate on the Microsoft API sets. This offers several advantages: First, by using all Microsoft API models, the programmer gets to work with a consistent set of interfaces that work well together. Second, there is no denying that Microsoft's presence in the marketplace adds strength to any service model they develop. The time you invest in learning a set of API calls to provide advanced Windows services is usually time well spent. Using Microsoft API models assures you that your knowledge will not be useless in a year or so when some other API model is abandoned due to lack of use. And third, the Microsoft approach to service models is designed to allow third-party vendors to contribute to the growth and development of the service model. This open approach means you're really learning how to create programs that work with a variety of hardware/software combinations and not tying your efforts to a single hardware or software system.
The messaging system explored in this book is the Microsoft Messaging API (MAPI). The MAPI system is one of the most widely used message models available for the pc environment. While there are other message models in use today, they are not covered here just because one book can't cover everything. If you are familiar with other message models, your knowledge will help you gain a greater understanding of the MAPI system.
The telephony model covered here is the Microsoft Telephony API (TAPI). Just as with message services, there are competing telephony service models, too. The primary advantage of TAPI to the programmer is that Microsoft has committed to providing the TAPI model as part of the basic operating system for all future versions of Windows. For example, TAPI is shipped as part of every Windows 95 operating system. Version 4.0 of Windows NT is also designed to contain TAPI services as a fundamental part of the operating system.
Another major advantage of the TAPI model is that it is designed to work with multiple hardware products. Programmers who use TAPI can be assured that their programs will work the same from one installation to the next as long as TAPI-compliant hardware is used at all locations.
The speech service discussed here is Microsoft's Speech API (SAPI). There are several vendor-specific speech APIs. As in the TAPI model, the real advantage of Microsoft's SAPI is that it is designed to support multiple third-party vendor products. By writing to the SAPI model, you can potentially increase the reach of your speech-enabled software to all SAPI-compliant hardware.
Some of the examples in this book also use the Microsoft Multimedia Communications Interface (MCI) to add audio and video services. This is a well-established interface that is supported by almost all existing audio and video hardware.
The programming examples in this book move from simple, high-level examples and progress to more complex, full-featured applications. Each section of the book has four basic parts:
Each section starts with the general theory of the API service. This includes coverage of the general design of the service model and its objects, methods, and properties. You'll also get information about the various developer tools available for building programs that use the target service.
You'll then learn how to create service-aware applications. This usually involves adding the target service to existing applications, such as adding Send, Dial, or Speak buttons to a form. Service-aware applications use the target service as an added feature instead of as a basic part of the program. You'll see how you can add service features using high-level code routines.
The next level of programming examples shows you how to build applications that take advantage of the target service as a basic part of the program design. Examples would be an e-mail message reader, an online address book that can dial the selected address at the push of a button, or a program that allows users to drag and drop text documents onto a palette and then reads a selected document aloud.
Lastly, you'll learn how to create applications that use the service in unique ways. For example, you could use the message service to send data between two programs running on different machines on the same network, or use TAPI services to create an answering machine application.
The final section of the book contains examples of applications that provide integrated services: using MAPI and TAPI to build a dial-up FAX-back application; building a program that allows users to dial in, request information from a database, and hear the results spoken to them over the phone; and creating a single application that combines messaging, telephony, and speech into a single voice-mail system.
While the examples in this book don't cover every possible use of the target APIs, you'll find enough examples here to give you the techniques and skills you'll need to build your own Windows applications to exploit the features of the MAPI, TAPI, and SAPI services.
In the past, if you wanted to access advanced Windows services like MAPI, SAPI, and TAPI, you had to use C or C++ developer tools. But now, with the introduction of OLE libraries and the Microsoft OCX add-in control specification, Microsoft has made it possible to access these advanced services from high-level developer tools like Visual Basic 4.0 and Microsoft FoxPro. You can even complete a number of the programming examples included in this book using the VBA-compatible Microsoft Office tools like Excel, Access, Word, and others.
Most of the programming examples presented in this book are done in the 32-bit version of Microsoft Visual Basic 4.0 Professional Edition. Several examples are done using Microsoft's Excel 95 and Microsoft Access 95. However, a few of the services are only available via C++ programming. You'll therefore see some short programming examples here using Microsoft's Visual C++ 4.0. If you do not own a copy of Visual C++, you can still get a lot out of the C++ examples simply by reading them to get the general concepts. None of the major projects in this book require coding in C++. In the cases where C++ code is needed to gain access to a specific feature in the Windows service, you'll find compiled OLE libraries and/or OCX tools included on the accompanying CD-ROM. You can use these compiled tools as part of your high-level language projects.
All of the programming concepts described here are applicable to non-Microsoft programming environments, too. If you are using products such as Borland's Delphi, dBASE, Borland C++, and so on, you can still get a lot out of this book. You'll need to re-create the detail of the code examples in code usable in your programming environment, but the Windows API calls will be exactly the same.
The programming examples in this book cover a wide range of hardware and software requirements, and it's no small matter to equip your workstation with all the tools necessary to access all the Windows services described within these pages. The following list summarizes the tools used in developing the programs presented here:
Even though this book covers a lot of territory, it leaves a lot out, too. The main focus of this book is the client desktop. However, there's another set of APIs designed for building server-side applications for Windows. Microsoft provides developer kits for the creation of MAPI message servers like transport providers, address books, and message storage systems. Every TAPI client depends on a server-side interface that talks directly to the vendor hardware to translate the requests from the client into something the hardware understands. Microsoft publishes the Telephony Service Provider Interface (TSPI) as a set of API calls for handling the server-side aspects of Windows telephony. Finally, the Speech API is designed to allow third-party vendors to create separate text-to-speech and speech recognition engines that work within the SAPI system.
Covering the details of each of these server-side models could fill an entire book. For our purposes, you'll learn the general facts about how the clients and servers relate to each other, but you'll need to look elsewhere if you want to learn how to build server-side components.
It is also important to keep in mind that all the material here was built for the Windows 95 platform. Even though many of the examples will run on other Windows platforms, not much will be said about Windows 3.1 or even Windows NT. This is mainly to keep the book clear of confusing exceptions and special notations for cases where the platforms behave in different ways. If you're unlucky enough to have the responsibility of deploying advanced Windows services on multiple platforms, you'll need to supplement this text with copious experimenting and tweaking.
Since this book is divided into very clear sections, you can use it in a number of ways:
No matter how you use this book, by the time you complete the examples and absorb the basic concepts explained here, you'll have a solid understanding of some of the most advanced Windows extension services available.
That's about it for the preliminaries-now it's time to get started!