Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TAPI APIs failing

Posted on 1997-04-07
2
Medium Priority
?
328 Views
Last Modified: 2013-12-03
I am trying to use TAPI 2.0 with I/O completion ports. The following code returns LINEERR_OPERATIONUNAVAIL

DWORD dwNumDevices = 0;
DWORD dwAPIVersion = TAPI_CURRENT_VERSION;
LINEINITIALIZEEXPARAMS parms;
parms.dwTotalSize = sizeof(LINEINITIALIZEEXPARAMS);
parms.dwOptions = LINEINITIALIZEEXOPTION_USECOMPLETIONPORT;
parms.dwCompletionKey = 1;
parms.Handles.hCompletionPort = comp;

long rc = lineInitializeEx(&myLineApp,
                     GetModuleHandle(0),
                     0,
                     0,
                     &dwNumDevices,
                     &dwAPIVersion,
                       &parms);

I can successfully use lineInialize, but I'd much rather use   I/O completion ports or event handles than the hidden window method of event notification.

Bill Weston

0
Comment
Question by:Bill Weston
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:Bill Weston
ID: 1334459
Edited text of question
0
 
LVL 1

Accepted Solution

by:
edtmihu earned 300 total points
ID: 1334460
I tried this:
HANDLE hFile = CreateFile( _T( "C:\\T.T" ), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_FLAG_OVERLAPPED, NULL );

HANDLE comp = ::CreateIoCompletionPort ( hFile, NULL, 1, 0 );
LINEINITIALIZEEXPARAMS lip;
::ZeroMemory( &lip, sizeof( lip ) );
lip.dwTotalSize = sizeof( lip );
lip.dwOptions = LINEINITIALIZEEXOPTION_USECOMPLETIONPORT;
lip.dwCompletionKey = 1;
lip.Handles.hCompletionPort = comp;
pTapi->hLineApp = 0;
pTapi->dwNumDevs = 0;
pTapi->dwAPIVersion = 0x00020000;

LONG err = ::lineInitializeEx( &pTapi->hLineApp, AfxGetApp()->m_hInstance, 0, AfxGetApp()->m_pszAppName, &pTapi->dwNumDevs, &pTapi->dwAPIVersion, &lip );

This worked for me. I'm using VC++ 4.2b. I have UNICODE defined.
I only checked the return value from ::lineInitializeEx(...), nothing more.

I use events myself. Like this:
LINEINITIALIZEEXPARAMS lip;
::ZeroMemory( &lip, sizeof( lip ) );
lip.dwTotalSize = sizeof( lip );
lip.dwOptions = LINEINITIALIZEEXOPTION_USEEVENT;
pTapi->hLineApp = 0;
pTapi->dwNumDevs = 0;
pTapi->dwAPIVersion = 0x00020000;

LONG err = ::lineInitializeEx( &pTapi->hLineApp, AfxGetApp()->m_hInstance, 0, AfxGetApp()->m_pszAppName, &pTapi->dwNumDevs, &pTapi->dwAPIVersion, &lip );
.
Check err
.
open line devices and stuff
.
while ( 1 )
 {
 DWORD dwEvent = WaitForMultipleObjects( 2, pTapi->hEvents, FALSE, INFINITE );
}
etc.
Works great.
Hope this helped

Regards/Michael
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question