<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3310182</guid>
        <pubDate>Thu, 09 May 2013 12:44:45 +0000</pubDate>
        <title>Консольная звонилка (PowerBasic)</title>
        <link>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3310182</link>
        <description><![CDATA[gigamaxx: <strong class='tag-b'>leo</strong>, с GetMessage не работает, к тому-же из её описания следует что функция возвращает значение не нуль, если сообщение не wm_Quit; 0 - в пpотивном случае.<br>
Получается, что выхода из цикла не будет (что я и наблюдаю), пока не прийдет wm_Quit.<br>
<br>
<strong class='tag-b'>B.V.</strong> Согласен<br>
<br>
Раскопал пример на С++ <span class="b-attach" data-size="62756" data-hits="148" data-attach-id="29234" data-attach-post-id="0">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=0&amp;attach_id=29234' title='Скачать файл' target='_blank'>tapiwave.zip</a> (, : 148)
		</span><br>
<br>
Тоже консоль, дозвон и проигрывание wav файла. Так вот внем collback работает&#33; После lineMakeCall идет вызов функции PumpMessages, за ней - lineShutdown.<br>
(Готовый exe-шник работает, а скомпилировать самому у меня не получилось ни под 6-й студией, ни под 2010 Express).<br>
Так вот в примере это выглядит так (сокращено):<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;lRet = lineMakeCall(hLine, &amp;hCall, szPhoneNumber, 0, lpLineCallParams);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;...</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;// TAPI callback is called only when messages are dispatched!</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;while (!bReadyToEnd || hCall)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;PumpMessages(TRUE);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;...</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;lineShutdown(hLineApp);</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
и сама функция PumpMessages:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">BOOL PumpMessages(BOOL bWaitForMessage)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;static MSG msg;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; if (bReadyToEnd)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; return FALSE;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; if (bWaitForMessage)</div><div class="code_line">&nbsp;&nbsp; {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (!GetMessage(&amp;msg, NULL, 0, 0))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;&nbsp; else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (!PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; return TRUE;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; if (msg.message == WM_QUIT)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; TranslateMessage(&amp;msg);</div><div class="code_line">&nbsp;&nbsp; DispatchMessage(&amp;msg);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; return TRUE;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
которую я преобразовал в код PowerBasic, отбросив лишнее:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Function PumpMessages(bWaitForMessage As Integer) As Integer</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Static MSG As tagmsg</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; If bWaitForMessage Then</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;If Not GetMessage(msg, %NULL, 0, 0) Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; Function = 0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Else</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;If Not PeekMessage(msg, %NULL, 0, 0, %PM_REMOVE) Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; Function = 1</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; TranslateMessage(msg)</div><div class="code_line">&nbsp;&nbsp; DispatchMessage(msg)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Function = 1</div><div class="code_line">&nbsp;</div><div class="code_line">End Function</div></ol></div></div></div></div><br>
             <br>
вызываю так:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; </div><div class="code_line">&nbsp;&nbsp;lRet = LineMakeCall (ByVal hLine, hCall, numberToDial, ByVal 0, lineParams)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; While hCall</div><div class="code_line">&nbsp;&nbsp; &nbsp; PumpMessages(1)</div><div class="code_line">&nbsp;&nbsp; Loop</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; LineDrop(ByVal hCall, ByVal 0, ByVal 0)</div></ol></div></div></div></div><br>
<br>
Не работает - падает....<br>
<br>
p.s. Не ясно, почему в PumpMessages передаётся TRUE, ведь тогда блок else никогда не выполняеся? или я что-то не так понимаю? Если принять, что bWaitForMessage<br>
всегда равно 1, то получается так:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Function PumpMessages() As Integer</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Static MSG As tagmsg</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; If Not GetMessage(msg, %NULL, 0, 0) Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Function = 0</div><div class="code_line">&nbsp;&nbsp; End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; TranslateMessage(msg)</div><div class="code_line">&nbsp;&nbsp; DispatchMessage(msg)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Function = 1</div><div class="code_line">&nbsp;</div><div class="code_line">End Function</div><div class="code_line">&nbsp;</div><div class="code_line">и вызов функции:</div><div class="code_line">&nbsp;</div><div class="code_line">While hCall</div><div class="code_line">&nbsp;&nbsp;PumpMessages</div><div class="code_line">Loop</div></ol></div></div></div></div><br>
<br>
тоже не работает. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2013-05-09T16:48:56+04:00">09.05.13, 12:48</time></span></span><br>
PS Как редактировать сообщение? В конце сообщения добавилось 4 одинаковых вложения]]></description>
        <author>gigamaxx</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3310154</guid>
        <pubDate>Thu, 09 May 2013 11:05:23 +0000</pubDate>
        <title>Консольная звонилка (PowerBasic)</title>
        <link>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3310154</link>
        <description><![CDATA[B.V.: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=376203&view=findpost&p=3309243'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>gigamaxx &#064; <time class="tag-quote__quoted-time" datetime="2013-05-07T08:31:56+00:00">07.05.13, 08:31</time></span><div class='quote '> Похоже разницы от этого никакой, так-что дело не в этом.</div></div><br>
Я и не говорил, что дело в этом. Просто если процедура обработки объявлена как функция и при этом ничего не возвращает, это логическая ошибка в коде]]></description>
        <author>B.V.</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3310114</guid>
        <pubDate>Thu, 09 May 2013 06:42:52 +0000</pubDate>
        <title>Консольная звонилка (PowerBasic)</title>
        <link>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3310114</link>
        <description><![CDATA[leo: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=376203&view=findpost&p=3309243'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>gigamaxx &#064; <time class="tag-quote__quoted-time" datetime="2013-05-07T08:31:56+00:00">07.05.13, 08:31</time></span><div class='quote '>В итоге всё снова упирается в особенности консоли и очередь сообщений</div></div><br>
Все упирается в неверное использование PeekMessage, которая в отличие от GetMessage не ждет появления событий в очереди. В итоге твой цикл &quot;быстренько&quot; обрабатывает сообщения, которые уже есть в очереди и завершается, не дожидаясь поступления новых сообщений. Причем поскольку ты зациклил вызов dial &quot;в исследовательских&quot; целях, то не исключено, что при повторных проходах PeekMessage извлекает из очереди сообщения, посланные (и не обработанные) в предыдущем цикле, которые могут быть уже невалидными из-за реинициализации линии.<br>
Для начала просто замени PeekMessage на GetMessage - если все заработает, то можно будет дальше что-то дорабатывть (например, добавить таймер, чтобы не ждать у моря погоды, и т.п.)]]></description>
        <author>leo</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3309243</guid>
        <pubDate>Tue, 07 May 2013 08:31:56 +0000</pubDate>
        <title>Консольная звонилка (PowerBasic)</title>
        <link>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3309243</link>
        <description><![CDATA[gigamaxx: <strong class='tag-b'>B.V.</strong>, а она должна что-то возвращать?<br>
<br>
MSDN:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">LONG WINAPI lineInitializeEx(</div><div class="code_line">&nbsp;&nbsp;LPHLINEAPP lphLineApp, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp;HINSTANCE hInstance, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp;LINECALLBACK lpfnCallback, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp;LPCSTR lpszFriendlyAppName, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp;LPDWORD lpdwNumDevs, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp;LPDWORD lpdwAPIVersion, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp;LPLINEINITIALIZEEXPARAMS lpLineInitializeExParams &nbsp;</div><div class="code_line">);</div></ol></div></div></div></div><br>
lpfnCallback <br>
<br>
Address of a callback function that is invoked to determine status and events on the line device, addresses, or calls, when the application is using the &quot;hidden window&quot; method of event notification (for more information see lineCallbackFunc). This parameter is ignored and should be set to NULL when the application chooses to use the &quot;event handle&quot; or &quot;completion port&quot; event notification mechanisms.<br>
<br>
вот я и передаю в функцию lineInitializeEx адрес tapiCallback при помощи функции CODEPTR <br>
<br>
lineInitializeEx(hTapiApp, hInstance, <span class="tag-color tag-color-named" data-value="blue" style="color: blue"><em class='tag-i'>CodePtr(tapiCallback)</em></span>...<br>
<br>
и в том-же MSDN сказано, что lineCallbackFunc не возвращает значения.<br>
<br>
В моём примере TapiCallback можно объявить и как процедуру, а не как функцию. Похоже разницы от этого никакой, так-что дело не в этом. (Кстати подобный код в PBWin<br>
 работает (без While PeekMessage ... Loop) - дозванивается и выводит сообщения, например в ListBox). В итоге всё снова упирается в особенности консоли и очередь сообщений, а т.к. я в этом далеко не спец приходится спрашивать... :-?]]></description>
        <author>gigamaxx</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3309103</guid>
        <pubDate>Mon, 06 May 2013 19:52:20 +0000</pubDate>
        <title>Консольная звонилка (PowerBasic)</title>
        <link>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3309103</link>
        <description><![CDATA[B.V.: А почему у тебя TapiCallback ничего не возвращает?]]></description>
        <author>B.V.</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3307125</guid>
        <pubDate>Mon, 29 Apr 2013 13:37:11 +0000</pubDate>
        <title>Консольная звонилка (PowerBasic)</title>
        <link>https://forum.sources.ru/index.php?showtopic=376203&amp;view=findpost&amp;p=3307125</link>
        <description><![CDATA[gigamaxx: Уважаемые форумчане&#33; Возникла необходимость написания консольной звонилки.<br>
<br>
Имеется код с использованием TAPI, который я немогу заставить адекватно работать. Длительные поиски не привели к успеху (встречалась пара подобных вопросов без ответов), задавал вопрос на другом форуме - ответа не получил, поэтому решил спросить и здесь.<br>
В чем заключается проблема: не удается получить ответ из CallBack функции.<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">#Compile Exe</div><div class="code_line">#Dim All</div><div class="code_line">&nbsp;</div><div class="code_line">#Include &quot;Tapi32.inc&quot;</div><div class="code_line">#Include &quot;WinUser.inc&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Global hCall As Dword</div><div class="code_line">&nbsp;</div><div class="code_line">Function PBMain</div><div class="code_line">&nbsp;&nbsp; &nbsp;Local numberToDial As String</div><div class="code_line">&nbsp;&nbsp; &nbsp;numberToDial = $DefNumberToDial</div><div class="code_line">&nbsp;&nbsp; &nbsp;&#39; Зациклено в исследовательских целях</div><div class="code_line">&nbsp;&nbsp; &nbsp;1:</div><div class="code_line">&nbsp;&nbsp; &nbsp;Con.Input &quot;Nomer: &quot;, numberToDial</div><div class="code_line">&nbsp;&nbsp; &nbsp;dial(numberToDial)</div><div class="code_line">&nbsp;&nbsp; &nbsp;GoTo 1</div><div class="code_line">End Function</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Function Dial(phoneNumber As String) As Long</div><div class="code_line">&nbsp;&nbsp; Local lRet As Long, hApiVersion As Long, numLines As Long, lineNo As Long</div><div class="code_line">&nbsp;&nbsp; Local minVer As Long, maxVer As Long, dwAPIVersion As Dword</div><div class="code_line">&nbsp;&nbsp; Local hLine As Dword</div><div class="code_line">&nbsp;&nbsp; Local numberToDial As AsciiZ * 32</div><div class="code_line">&nbsp;&nbsp; Local lineParams As LINECALLPARAMS, extID As LINEEXTENSIONID</div><div class="code_line">&nbsp;&nbsp; Local lip As LINEINITIALIZEEXPARAMS</div><div class="code_line">&nbsp;&nbsp; Local hInstance As Dword, hTapiApp As Dword</div><div class="code_line">&nbsp;&nbsp; Local i As Long</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Local Msg As tagMsg</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; lip.dwtotalsize = Len(lip)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; lip.dwoptions = %LINEINITIALIZEEXOPTION_USEHIDDENWINDOW</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; hApiVersion = %TAPI_CURRENT_VERSION</div><div class="code_line">&nbsp;&nbsp; numberToDial = phoneNumber</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; hInstance = GetModuleHandle(ByVal %NULL)</div><div class="code_line">&nbsp;&nbsp; </div><div class="code_line">&nbsp;&nbsp; &#39;PeekMessage(msg, %Null, 0, 0, %PM_REMOVE)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; lRet = lineInitializeEx(hTapiApp, hInstance, CodePtr(tapiCallback), &quot;weqweqweqeweqwe&quot;, numLines, hApiVersion, lip)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; If lRet Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; Print &quot;Error on LineInitialize: &quot; + Str$(lRet)</div><div class="code_line">&nbsp;&nbsp; End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; lineNo = -1</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; For i = 0 To numLines - 1</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;minVer = &amp;h00010004</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;maxVer = &amp;h00020000</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;lRet = LineNegotiateAPIVersion(ByVal hTapiApp, ByVal i, ByVal minVer, ByVal maxVer, dwAPIVersion, extID)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;If lRet Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; Print &quot;Error negotiation API Version: &quot; + Str$(lRet)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;lRet = LineOpen (ByVal hTapiApp, ByVal i, hLine, ByVal dwAPIVersion, ByVal 0, ByVal 0, ByVal %LINECALLPRIVILEGE_NONE, ByVal %LINEMEDIAMODE_DATAMODEM, lineParams)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;If lRet Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Error on LineOpen: &quot; + Str$(lRet)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lineNo = i</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Exit For</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Next i</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; If lineNo &#60; 0 Then Print &quot;Could not find modem&quot;: Exit Function</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; lineParams.dwTotalSize = SizeOf(LINECALLPARAMS)</div><div class="code_line">&nbsp;&nbsp; lineParams.dwMediaMode = %LINEMEDIAMODE_DATAMODEM</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; lRet = LineMakeCall (ByVal hLine, hCall, numberToDial, ByVal 0, lineParams)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; If lRet &#60; 0 Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Print &quot;Error making call: &quot; + Str$(lRet)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Exit Function</div><div class="code_line">&nbsp;&nbsp; End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; While PeekMessage(msg, %Null, 0, 0, %PM_REMOVE)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;TranslateMessage(msg)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;DispatchMessage(msg) &#39;&#60;-- вот здесь прога падает</div><div class="code_line">&nbsp;&nbsp; Loop</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Print &quot;&#62;&#62;&#62;&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; LineDrop(ByVal hCall, ByVal 0, ByVal 0)</div><div class="code_line">&nbsp;&nbsp; LineClose(ByVal hLine)</div><div class="code_line">&nbsp;&nbsp; LineShutdown(ByVal hTapiApp)</div><div class="code_line">&nbsp;</div><div class="code_line">End Function</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Function TapiCallback(ByVal hDevice&amp;, ByVal dwMsg&amp;, ByVal CBInstance&amp;,_</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ByVal Param1&amp;, ByVal Param2&amp;, ByVal Param3&amp;) As Long</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Local nDim As Long, Dword As Long, dwNeed As Dword, sDevice As AsciiZ * 16</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;If dwMsg&amp; = %LINE_REPLY Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;If Param2&amp; &#60; 0 Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Line Reply Error&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Line Reply Ok&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp;ElseIf dwMsg&amp; = %LINE_CALLSTATE Then</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Select Case Param1&amp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Case %LINECALLSTATE_IDLE</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If hCall &#60;&#62; 0 Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Line Idle&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Case %LINECALLSTATE_CONNECTED</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If hCall &#60;&#62; 0 Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Connected&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Case %LINECALLSTATE_PROCEEDING</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Proceeding&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Case %LINECALLSTATE_DIALING</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Dialing...&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Case %LINECALLSTATE_DISCONNECTED</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If Param2&amp; = %LINEDISCONNECTMODE_NORMAL Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Disconnected Normal&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ElseIf Param2&amp; = %LINEDISCONNECTMODE_BUSY Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Disconnected Busy&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ElseIf Param2&amp; = %LINEDISCONNECTMODE_NODIALTONE Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;No dial tone&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ElseIf Param2&amp; = %LINEDISCONNECTMODE_NOANSWER Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;No Answer&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Case %LINECALLSTATE_BUSY</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print &quot;Line Busy&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;End Select</div><div class="code_line">&nbsp;&nbsp; &nbsp;End If</div><div class="code_line">&nbsp;</div><div class="code_line">End Function</div></ol></div></div></div></div><br>
<br>
после LineMakeCall (если закомментирован цикл с PeekMessage) сразуже происходит вызов LineDrop, соответсвенно я никуда не звоню. Если между ними вставить что-то вроде Waitkey&#036; вызов происходит и завершается после нажатия любой клавиши. С незакомментированным циклом PeekMessage программа падает на DispatchMessage(msg) - Unhandled exception... (XP) или Прекращена работа программы (Win7). Без вызова DispatchMessage вызов произходит нормально (почти) и LineDrop происходит после отбоя вызываемого номера. Но смысл весь в том, что нужно видеть процесс дозвона и отбоя, а для этого использовать callback.<br>
<br>
В чем мооя ошибка? В какую сторну ковырять? Help&#33;&#33;&#33;<br>
<br>
p.s. Извиняюсь за сумбурное изложение... :blush:]]></description>
        <author>gigamaxx</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      </channel>
      </rss>
	