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

📄 ch26.htm

📁 MAPI__SAPI__TAPI
💻 HTM
📖 第 1 页 / 共 5 页
字号:
  structdata <font FACE="ZAPFDINGBATS">&Acirc;</font>As LINEADDRESSCAPS, ByVal ExtraData As 
  String)<br>
  Declare Sub LineCallInfoFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, structdata 
  As <font FACE="ZAPFDINGBATS">&Acirc;</font>LINECALLINFO, ByVal ExtraData As String)<br>
  Declare Sub LineCallStatusFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, 
  structdata <font FACE="ZAPFDINGBATS">&Acirc;</font>As LINECALLSTATUS, ByVal ExtraData As 
  String)<br>
  Declare Sub LineCallListFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, structdata 
  As <font FACE="ZAPFDINGBATS">&Acirc;</font>LINECALLLIST, ByVal ExtraData As String)<br>
  Declare Sub LineDevCapsFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, structdata 
  As <font FACE="ZAPFDINGBATS">&Acirc;</font>LINEDEVCAPS, ByVal ExtraData As String)<br>
  Declare Sub VarStringFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, structdata As <font
  FACE="ZAPFDINGBATS">&Acirc;</font>VARSTRING, ByVal ExtraData As String) <br>
  Declare Sub LineDevStatusFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, structdata 
  As <font FACE="ZAPFDINGBATS">&Acirc;</font>LINEDEVSTATUS, ByVal ExtraData As String)<br>
  Declare Sub LineTranslateCapsFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, <font
  FACE="ZAPFDINGBATS">&Acirc;</font>structdata As LINETRANSLATECAPS, ByVal ExtraData As 
  String)<br>
  Declare Sub LineMonitorToneFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, 
  structdata <font FACE="ZAPFDINGBATS">&Acirc;</font>As LINEMONITORTONE)<br>
  Declare Sub LineExtensionIDFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, 
  structdata <font FACE="ZAPFDINGBATS">&Acirc;</font>As LINEEXTENSIONID)<br>
  Declare Sub LineDialParmsFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, structdata 
  As <font FACE="ZAPFDINGBATS">&Acirc;</font>LINEDIALPARAMS)<br>
  Declare Sub LineMediaControlDigitFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, <font
  FACE="ZAPFDINGBATS">&Acirc;</font>structdata As LINEMEDIACONTROLDIGIT) <br>
  Declare Sub LineTranslateOutputFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, <font
  FACE="ZAPFDINGBATS">&Acirc;</font>structdata As LINETRANSLATEOUTPUT, ByVal ExtraData As 
  String)<br>
  Declare Sub LineAddressStatusFunc Lib &quot;pstapidll32&quot; (ByVal nMode As Long, <font
  FACE="ZAPFDINGBATS">&Acirc;</font>structdata As LINEADDRESSSTATUS, ByVal ExtraData As 
  String)<br>
  <br>
  '<br>
  ' constants for read/write of params<br>
  '<br>
  Global Const TAPI_WRITE = 0<br>
  Global Const TAPI_READ = 1</font></tt> </p>
</blockquote>

<hr>

<p>You'll notice that the global constants for <tt><font FACE="Courier">TAPI_WRITE</font></tt> 
and <tt><font FACE="Courier">TAPI_READ</font></tt> appear at the end of the DLL 
declarations. These are used for the <tt><font FACE="Courier">nMode</font></tt> parameter 
of the DLL calls. </p>

<p>After the DLL declares, you'll see a list of TAPI error message values that could be 
returned. Listing 26.5 shows the error values that appear in the <tt><font FACE="Courier">TAPILINE.BAS</font></tt> 
module. </p>

<hr>

<blockquote>
  <b><p>Listing 26.5. The TAPI error message values.<br>
  </b></p>
</blockquote>

<blockquote>
  <tt><font FACE="Courier"><p>'<br>
  ' ************************************************<br>
  ' general TAPI constants<br>
  ' ************************************************<br>
  '<br>
  Global Const TAPI_REPLY = &amp;H400&amp; + 99&amp;<br>
  <br>
  Global Const TAPIERR_CONNECTED = 0&amp;<br>
  Global Const TAPIERR_DROPPED = -1&amp;<br>
  Global Const TAPIERR_NOREQUESTRECIPIENT = -2&amp;<br>
  Global Const TAPIERR_REQUESTQUEUEFULL = -3&amp;<br>
  Global Const TAPIERR_INVALDESTADDRESS = -4&amp;<br>
  Global Const TAPIERR_INVALWINDOWHANDLE = -5&amp;<br>
  Global Const TAPIERR_INVALDEVICECLASS = -6&amp;<br>
  Global Const TAPIERR_INVALDEVICEID = -7&amp;<br>
  Global Const TAPIERR_DEVICECLASSUNAVAIL = -8&amp;<br>
  Global Const TAPIERR_DEVICEIDUNAVAIL = -9&amp;<br>
  Global Const TAPIERR_DEVICEINUSE = -10&amp;<br>
  Global Const TAPIERR_DESTBUSY = -11&amp;<br>
  Global Const TAPIERR_DESTNOANSWER = -12&amp;<br>
  Global Const TAPIERR_DESTUNAVAIL = -13&amp;<br>
  Global Const TAPIERR_UNKNOWNWINHANDLE = -14&amp;<br>
  Global Const TAPIERR_UNKNOWNREQUESTID = -15&amp;<br>
  Global Const TAPIERR_REQUESTFAILED = -16&amp;<br>
  Global Const TAPIERR_REQUESTCAncELLED = -17&amp;<br>
  Global Const TAPIERR_INVALPOINTER = -18&amp;<br>
  Global Const TAPIMAXDESTADDRESSSIZE = 80&amp;<br>
  Global Const TAPIMAXAPPNAMESIZE = 40&amp;<br>
  Global Const TAPIMAXCALLEDPARTYSIZE = 40&amp;<br>
  Global Const TAPIMAXCOMMENTSIZE = 80&amp;<br>
  Global Const TAPIMAXDEVICECLASSSIZE = 40&amp;<br>
  Global Const TAPIMAXDEVICEIDSIZE = 40&amp;</font></tt> </p>
</blockquote>

<hr>

<p>Next, there is the list of callback message values. These will be used to check the <tt><font
FACE="Courier">MessageID</font></tt> values returned in the <tt><font FACE="Courier">TapiCallBack</font></tt> 
event of the <tt><font FACE="Courier">TAPILINE</font></tt> control. Listing 26.6 shows the 
list of 14 possible messages. </p>

<hr>

<blockquote>
  <b><p>Listing 26.6. The <tt><font FACE="Courier">TAPICallBack</font></tt> message Ids.<br>
  </b></p>
</blockquote>

<blockquote>
  <tt><font FACE="Courier"><p>'<br>
  ' Line callback messages<br>
  '<br>
  Global Const LINE_ADDRESSSTATE = 0&amp;<br>
  Global Const LINE_CALLINFO = 1&amp;<br>
  Global Const LINE_CALLSTATE = 2&amp;<br>
  Global Const LINE_CLOSE = 3&amp;<br>
  Global Const LINE_DEVSPECIFIC = 4&amp;<br>
  Global Const LINE_DEVSPECIFICFEATURE = 5&amp;<br>
  Global Const LINE_GATHERDIGITS = 6&amp;<br>
  Global Const LINE_GENERATE = 7&amp;<br>
  Global Const LINE_LINEDEVSTATE = 8&amp;<br>
  Global Const LINE_MONITORDIGITS = 9&amp;<br>
  Global Const LINE_MONITORMEDIA = 10&amp;<br>
  Global Const LINE_MONITORTONE = 11&amp;<br>
  Global Const LINE_REPLY = 12&amp;<br>
  Global Const LINE_REQUEST = 13&amp;</font></tt> </p>
</blockquote>

<hr>

<h3><a NAME="TheLineStructuresandConstants">The Line Structures and Constants</a></h3>

<p>There are numerous constants and declarations needed to support all the TAPI line 
device functions. There are too many to include here, but one is shown in Listing 26.7 to 
give you an example. </p>

<hr>

<blockquote>
  <b><p>Listing 26.7. An example line constant and type declaration. <br>
  </b></p>
</blockquote>

<blockquote>
  <tt><font FACE="Courier"><p>Global Const LINEADDRCAPFLAGS_FWDNUMRINGS = &amp;H1&amp;<br>
  Global Const LINEADDRCAPFLAGS_PICKUPGROUPID = &amp;H2&amp;<br>
  Global Const LINEADDRCAPFLAGS_SECURE = &amp;H4&amp;<br>
  Global Const LINEADDRCAPFLAGS_BLOCKIDDEFAULT = &amp;H8&amp;<br>
  Global Const LINEADDRCAPFLAGS_BLOCKIDOVERRIDE = &amp;H10&amp; <br>
  Global Const LINEADDRCAPFLAGS_DIALED = &amp;H20&amp;<br>
  Global Const LINEADDRCAPFLAGS_ORIGOFFHOOK = &amp;H40&amp;<br>
  Global Const LINEADDRCAPFLAGS_DESTOFFHOOK = &amp;H80&amp;<br>
  Global Const LINEADDRCAPFLAGS_FWDCONSULT = &amp;H100&amp;<br>
  Global Const LINEADDRCAPFLAGS_SETUpcONFNULL = &amp;H200&amp;<br>
  Global Const LINEADDRCAPFLAGS_AUTORECONNECT = &amp;H400&amp;<br>
  Global Const LINEADDRCAPFLAGS_COMPLETIONID = &amp;H800&amp;<br>
  Global Const LINEADDRCAPFLAGS_TRANSFERHELD = &amp;H1000&amp;<br>
  Global Const LINEADDRCAPFLAGS_TRANSFERMAKE = &amp;H2000&amp;<br>
  Global Const LINEADDRCAPFLAGS_CONFEREncEHELD = &amp;H4000&amp; <br>
  Global Const LINEADDRCAPFLAGS_CONFEREncEMAKE = &amp;H8000&amp; <br>
  Global Const LINEADDRCAPFLAGS_PARTIALDIAL = &amp;H10000<br>
  Global Const LINEADDRCAPFLAGS_FWDSTATUSVALID = &amp;H20000<br>
  Global Const LINEADDRCAPFLAGS_FWDINTEXTADDR = &amp;H40000<br>
  Global Const LINEADDRCAPFLAGS_FWDBUSYNAADDR = &amp;H80000<br>
  Global Const LINEADDRCAPFLAGS_AccEPTTOALERT = &amp;H100000<br>
  Global Const LINEADDRCAPFLAGS_CONFDROP = &amp;H200000<br>
  Global Const LINEADDRCAPFLAGS_PICKUpcALLWAIT = &amp;H400000<br>
  <br>
  Type LINEADDRESSCAPS<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwTotalSize As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwNeededSize As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwUsedSize As Long<br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwLineDeviceID As Long<br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwAddressSize As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwAddressOffset As Long<br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwDevSpecificSize As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwDevSpecificOffset As Long<br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwAddressSharing As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwAddressStates As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCallInfoStates As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCallerIDFlags As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCalledIDFlags As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwConnectedIDFlags As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwRedirectionIDFlags As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwRedirectingIDFlags As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCallStates As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwDialToneModes As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwBusyModes As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwSpecialInfo As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwDisconnectModes As Long<br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxNumActiveCalls As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxNumOnHoldCalls As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxNumOnHoldPendingCalls As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxNumConference As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxNumTransConf As Long<br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwAddrCapFlags As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCallFeatures As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwRemoveFromConfCaps As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwRemoveFromConfState As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwTransferModes As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwParkModes As Long<br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwForwardModes As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxForwardEntries As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxSpecificEntries As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMinFwdNumRings As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxFwdNumRings As Long<br>
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwMaxCallCompletions As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCallCompletionConds As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCallCompletionModes As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwNumCompletionMessages As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCompletionMsgTextEntrySize As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCompletionMsgTextSize As Long<br>
  &nbsp;&nbsp;&nbsp;&nbsp;dwCompletionMsgTextOffset As Long<br>
  End Type<br>
  Global Const LINEADDRESSCAPS_FIXEDSIZE = 176<br>
  <br>
  Type LINEADDRESSCAPS_STR<br>
  &nbsp;&nbsp;&nbsp;&nbsp;Mem As String * LINEADDRESSCAPS_FIXEDSIZE <br>
  End Type</font></tt> </p>
</blockquote>

<hr>

<p>You'll notice a set of constants that appear before the type declaration. These can be 
used to set various TAPI parameters within the data structure. Some declarations are 
return values that can be read once TAPI has set or modified the data within the 
structure. The <tt><font FACE="Courier">TAPILINE.BAS</font></tt> module contains many of 
these sets of constants and data structure declarations. The <tt><font FACE="Courier">VBTAPI</font></tt> 
folder also contains a similar module for phone device declarations. Although the <tt><font
FACE="Courier">TAPILINE</font></tt> control currently only supports line devices, a future 
version may provide support for phone devices. </p>

<p>For now, you can load the <tt><font FACE="Courier">TAPILINE.BAS</font></tt> module into 
your Visual Basic programs that use the <tt><font FACE="Courier">TAPILINE.OCX</font></tt> 
control. </p>

<h2><a NAME="TheTAPILineFunctionModule"><font SIZE="5" COLOR="#FF0000">The </font><tt><font
SIZE="5" COLOR="#FF0000" FACE="Courier">TAPILine</font></tt><font SIZE="5" COLOR="#FF0000"> 
Function Module</font></a></h2>

<p>The <tt><font FACE="Courier">TAPICALL.BAS</font></tt> module contains several routines 
needed to support TAPI calls using <tt><font FACE="Courier">TAPILINE.OCX</font></tt> and 
the <tt><font FACE="Courier">PSTAPIDLL</font></tt> file. Again, typing them all in is 
boring. Instead, this section reviews several of the more important example routines. You 
can load the <tt><font FACE="Courier">TAPICALL.BAS</font></tt> module into your Visual 
Basic projects and use these routines without having to re-enter all the code. </p>

<h3><a NAME="TheTAPICallBackHandlerFunction">The <tt><font SIZE="4" FACE="Courier">TAPICallBackHandler</font></tt><font
SIZE="4"> Function</font></a></h3>

<p>The most important routine in the <tt><font FACE="Courier">TAPICALL.BAS</font></tt> 
module is the <tt><font FACE="Courier">TAPICallBackHandler</font></tt> function. This 
routine takes the parameters returned in the <tt><font FACE="Courier">TAPICallBack</font></tt> 
event of the <tt><font FACE="Courier">TAPILINE.OCX</font></tt> and dispatches messages 
based on the return values. Listing 26.8 shows the code for the <tt><font FACE="Courier">TAPICallBackHandler</font></tt>. 
</p>

<hr>

<blockquote>
  <b><p>Listing 26.8. Code for the <tt><font FACE="Courier">TAPICallBackHandler</font></tt> 
  function.<br>
  <br>
  </b></p>
</blockquote>

<blockquote>
  <tt><font FACE="Courier"><p>Public Function TapiCallBackHandler(hDevice As Long, dwMessage 
  As Long, dwInstance As Long, dwParam1 As Long, dwParam2 As Long, dwParam3 As Long) As 
  String<br>
  &nbsp;&nbsp;&nbsp;&nbsp;'<br>
  &nbsp;&nbsp;&nbsp;&nbsp;' handle messages from TAPI control<br>

⌨️ 快捷键说明

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