Share via


Initializing TAPI (Windows Embedded CE 6.0)

1/6/2010

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 member.

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

Reference

TAPI Functions

Concepts

Establishing a Modem Connection