Initializing TAPI

When the application initializes TAPI, it must establish a way to communicate with TAPI. By calling the lineInitialize function, the application submits the address of a callback function to TAPI. By using the lineInitializeEx function, the application can choose either callback notifications or a Microsoft Win32® event-based notification. By use of the event-based notification mechanism, the application can retrieve TAPI messages as they become available by calling the lineGetMessage function. lineGetMessage can be used to wait a specified amount of time for the next message. The application also can wait on the event itself. The event handle is returned in the LINEINITIALIZEEXPARAMS.Handles.hEvent field.

The following code example shows how to initialize TAPI.

DWORD InitializeTAPI()
{
    LPLINETRANSLATECAPS lpXlatCaps;
    LONG  rc;

    LINEINITIALIZEEXPARAMS    LineInitializeExParams = {
        sizeof(LINEINITIALIZEEXPARAMS),    //dwTotalSize
        0,                                 //dwNeededSize
        0,                                 //dwUsedSize
        LINEINITIALIZEEXOPTION_USEEVENT,   //dwOptions
        0,                                 //Handles
        0                                  //dwCompletionKey
    };

    dwAPIVersion = TAPI_CURRENT_VERSION;
    dwExtVersion = 0;

    rc = lineInitializeEx(
            &hLineApp,
            hInstance,
            NULL,
            szAppName,
            &dwNumLines,
            &dwAPIVersion,
            &LineInitializeExParams
            );
 
    if (rc) {
        NKDbgPrintfW(TEXT("%s: lineInitializeEx failed %x\n"), szAppName, rc);
    }
    return rc;
}

See Also

Establishing a Modem Connection | TAPI Functions

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.