⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vcg21.htm

📁 Visual C++与数据库的连接经典实例
💻 HTM
📖 第 1 页 / 共 5 页
字号:

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Windows Telephony Interfaces</B></FONT></CENTER></H4>

<BR>

<P>Like MAPI, TAPI actually consists of two categories of interfaces. One interface is used to connect external devices to a computer or a LAN, and the other provides the services required by computer applications that use the external telephony devices. The two interfaces defined for Windows telephony are described as follows:

<BR>

<UL>

<LI>The Telephony <I>Service Provider</I> (SP) <I>Interface</I> (TSPI) that independent suppliers of line and phone devices use to conform their products to TAPI. In most cases, the service provider supplies a plug-in card or (preferably) network adapter to connect the device to a conventional Ethernet, token-ring, or other type of LAN, together with a TSPI-compliant driver. A standard TSPI overcomes the problems created by the current set of widely differing interfaces to services such as the analog Public Service Telephone Network (PSTN), proprietary PBXs, key telephone systems, cellular networks, and the Integrated Service Digital Network (ISDN) that the regional telcos and independent carriers are creating. Examples of SP interfaces include the TeleCommander and Phone Blaster cards mentioned earlier.

<BR>

<LI>The Telephony <I>Application Programming Interface</I> (the actual TAPI component) lets applications control telephony functions. These functions include the basic telephony activities, such as establishing, answering, and terminating a telephone call. TAPI also provides supplementary functions, such as holding and transferring calls, setting up conference calls, and call parking. TAPI is extensible so as to let service providers define additional custom functions for their particular hardware or communication services. TAPI is designed to isolate the application from the underlying line and phone devices, much as Print Manager isolates Windows applications from the various printer devices attached to computers or directly to the network. An example of an application that fully uses TAPI is Microsoft Voice.

<BR>

</UL>

<P>Both TAPI and TSPI are designed for compiling into 16-bit Windows 3.1 applications and 32-bit applications for 32-bit versions of Windows (Windows NT and Windows 95). Both interfaces use 32-bit (double word, 4-byte) unsigned integers for handles.

<BR>

<BR>

<A NAME="E69E271"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Simple TAPI and Extended TAPI</B></FONT></CENTER></H4>

<BR>

<P>TAPI, again like MAPI, provides two levels of sophistication of telephony services within Windows applications. The differences between Simple TAPI and Extended TAPI, which roughly correspond to the differences between Simple MAPI and Extended MAPI, are as follows:

<BR>

<UL>

<LI><I>Simple TAPI</I> lets telephony-aware applications incorporate outbound calling functions from within the application. For example, you might double-click a telephone number or a toolbar button with a telephone icon in a word-processing, spreadsheet, database, or PIM application to make an outbound call. Assuming that you have a built-in PC phone, the TSPI driver places the line device off hook and then uses dual-tone multifrequency (DTMF) or Touch-Tone dialing to call the number. The process is identical to printing to a fax and then sending it through a local or network fax modem card, except that you don't need the modem.

<BR>

<LI><I>Extended TAPI</I> (also called <I>Full TAPI</I>) provides telephony-enabled applications with full control of all operations associated with a telephone call. Most telephone-enabled applications run in first-party mode, where the phone device is an end point (originator or recipient) of the call. Telephony-enabled applications can place calls, receive notification of inbound calls, answer inbound calls, activate call-switching features (such as hold, transfer, conference, pickup, and park), and detect and generate DTMF signals that control remote devices. Extended TAPI also enables third-party control of calls. Third-party mode is similar to the operation of a private branch exchange (PBX); the PBX operator is the third party to the conversation, not an end-point of the call.

<BR>

</UL>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE><B>NOTE</B>

<BR>

<BR>Microsoft Voice is an example of an Extended TAPI application. It can be configured to work as an automated customer support system, can have multiple mailboxes, and can handle distinctive ringing and Caller ID signals.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>Simple TAPI and MAPI are sufficient to handle most of the basic messaging requirements of an e-mail system. The proof of this is that, at the time this book was written, Microsoft Mail had reached version 3.5 and had obtained about 30 percent of the mail market. (Lotus's cc:Mail is estimated to have about 50 percent of the market.) Simple TAPI is quite limited in its capabilities. Therefore, you can expect that most applications will implement Extended TAPI and MAPI support.

<BR>

<BR>

<A NAME="E69E272"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Visual C++ Database Applications and TAPI</B></FONT></CENTER></H4>

<BR>

<P>MAPI uses flat-file databases, created when you install Microsoft Mail 3.5, Windows NT, or Windows 95, to store the data required for workgroup and enterprise-wide postoffices, as well as messages. Microsoft's forthcoming Exchange Server replaces the flat file with an RDBMS that serves the same purpose. The file MAILBOX.PST (typically) holds the messages, while the file MAILBOX.PAB (typically, although the user may select other names for these files) holds the user's address book. TAPI, on the other hand, doesn't include a database element; it stores no user information. The lack of a built-in database gives independent software vendors and Visual C++ database developers a new opportunity to expand their product lines and the scope of their consulting activities.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE><B>NOTE</B>

<BR>

<BR>.PST files aren't in Microsoft Access format. This format is proprietary and unpublished.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>Microsoft and the ISVs are expected to make existing Windows applications telephony-aware in the first upgrade that follows the widespread availability of line and phone devices and the TSPI drivers to support these products. This should start happening in mid-1996, because TAPI-compatible hardware devices are now available. The initial hardware and TSPI drivers are expected to come from existing telephone switch manufacturers, such as Northern Telecom and Rolm Corp., and vendors of PC-based telephone adapter cards and call-management applications. Both Diamond MultiMedia and Creative Labs have hardware on the market, and other manufacturers are quickly adding voice-compatible products to their communications lines. There are a variety of opportunities for designing and writing large-scale telephony-enabled Visual C++ database applications, such as applications to manage telemarketing &quot;boiler rooms,&quot; as well as for add-in products that telephony-enable existing Visual C++ database applications with Extended TAPI, rather than making applications only telephony-aware with Simple TAPI.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE><B>NOTE</B>

<BR>

<BR>The authors of this book had the pleasure of testing some of the Microsoft Voice products (including Diamond's TeleCommander). The capabilities of these products offer great potential for database developers. Adding a telephone to the test computer required no new hardware. The TeleCommander (which is also a sound card) speakers and microphone formed a working speaker phone. Replacing the speakers with a headset offered an additional degree of flexibility.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<BR>

<A NAME="E70E117"></A>

<H5 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Database Applications That Use Inbound Caller ID Services</B></FONT></CENTER></H5>

<BR>

<P>It is likely that forthcoming Visual C++ database applications will take advantage of the Caller ID services that are provided by local telco exchanges under Signaling System No. 7 (SS7). The Caller ID (Individual Calling Line Identification (ICLID)) service provides the date and time of an inbound call, the calling line number, and a message. The message can be the name of the calling party as it appears in the telephone directory, &quot;Private&quot; (indicating that the caller has invoked ICLID's Block feature to prevent the calling line number from being transmitted), or &quot;Out of Area&quot; (indicating that ICLID services aren't available at the caller's location).

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE><B>NOTE</B>

<BR>

<BR>At the time this book was written, Caller ID was available in all states except California. The value of Caller ID can't be downplayed. Telephone users can screen calls, let answering machines answer incoming calls, and obtain a number to call back when they receive calls that they can't answer. Caller ID is proving to be quite useful in minimizing harassing, nuisance, and other undesirable phone calls[md]not the least of which are phone solicitors!</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>ICLID data is transmitted by FSK (frequency-shift keying, a method similar to that used by 1,200-bps modems) during the silent period between the first and the second rings. A related service, Automatic Number Identification (ANI), is provided by local telcos for 1-800 inbound WATS (wide-area telephone service) lines and ISDN lines. ANI data is transmitted in the form of DTMF signals before the first ring. Generally, TAPI-compatible hardware will respond to or monitor both ICLID and ANI signals.

<BR>

<P>You can use ICLID or ANI data to perform a <U>Seek</U> operation on a table that contains an indexed field with the telephone numbers of clients, customers, or subscribers. An application can display the inbound caller's record before the first or second ring. TV shopping channels can use reverse telephone directories stored on CD-ROMs to acquire name and address information on the calling buyer.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE><B>NOTE</B>

<BR>

<BR>Most large companies now use Centrex systems (or an equivalent) so that each employee with a telephone has a direct line for inbound and outbound calling. Thus, you can create database records for individuals within large firms. Reverse directories, however, don't include entries for individual Centrex lines.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<BR>

<A NAME="E70E118"></A>

<H5 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Integrated Messaging Systems</B></FONT></CENTER></H5>

<BR>

<P>Another application for TAPI is integrating voice-mail messages with e-mail messages in your in-box. Using MAPI, ICLID and TAPI, and a database similar to that described in the preceding section, you can create applications that make voice-mail messages appear in a format similar to that of Mail messages. Double-clicking a voice-mail message header brings up the caller's record (if one exists) or a blank record for an unidentified caller, and simultaneously plays the voice-mail message through your handset or a set of PC speakers.

<BR>

<P>Microsoft Voice can be programmed to read your e-mail to you over the phone. This feature can be very useful for people who aren't in their offices and receive important e-mail that must be responded to.

<BR>

<BR>

<A NAME="E68E111"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>MSComm Services</B></FONT></CENTER></H3>

<BR>

<P>Visual C++ 4 offers a new set of functionality: the Microsoft Comm Control. This OLE control allows an application to interface with a serial port directly. Don't confuse interfacing with a serial port directly with the task of interfacing with a modem. You should interface with modems using TAPI. There are situations in which you've dedicated hardware that is connected to a serial port (perhaps a bar code scanner) that the application must interface with.

<BR>

<P>You can use the communications control to provide serial communications between your application and a selected serial port. These controls are managed with the MSComm class, which is inserted into your application's project using Insert | Component.

<BR>

<P>The application can use event-driven communications, a very powerful method of handling serial ports, or use polling to check for events and errors.

<BR>

<P>Often your application will want to be notified when an event takes place, such as when a character arrives or a change occurs in a comm port status line. The MSComm class permits this type of notification.

<BR>

<P>The application also can poll for events and errors. This is done by checking the value of an MSComm property (usually after each critical function in your application). Polling is often preferable when the application is small and self-contained. An example is a simple phone dialer.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE><B>NOTE</B>

<BR>

<BR>The Microsoft Communications control is covered more fully in Chapter 17, &quot;Using OLE Controls and Automation with Visual C++ Applications.&quot;</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<BR>

<A NAME="E68E112"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Summary</B></FONT></CENTER></H3>

<BR>

<P>This chapter covered MAPI, TAPI, and Microsoft Exchange. It discussed mail-aware applications and interfacing with Schedule+. You also saw how to add MAPI support to a Visual C++ 4 application.

<BR>

<P>Relatively few commercial Visual C++ database applications use the Messaging API. Fewer yet use the Schedule+ Libraries, and none currently use the Telephony APIs. As the use of e-mail becomes more pervasive and service providers create the hardware and drivers required to implement TAPI, the demand for applications that integrate MAPI, TAPI, and perhaps even Schedule+ will increase dramatically. This chapter demonstrated that employing MAPI MFC 4 support is currently the best approach to creating mail-aware Visual C++ database front-end applications.

<BR>

<P>This chapter completes Part V of this book. The three chapters in Part VI, &quot;Distributing Production Database Applications,&quot; describe the process of upgrading a completed Visual C++ database application to full-fledged production status.

<BR>

<P ALIGN=CENTER>

<A HREF="vcg20.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/vcg20.htm" TARGET="_self"><IMG SRC="blanprev

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -