Where are the Samples for TAPI in the SDK as referred to in Learn. Code for C & VB etc.

Gregory Reed 0 Reputation points
2025-01-21T12:12:36.48+00:00

Hi,

Have installed the SDK, every single option ticked. I think had most before as was using Visual Studio before.

As below, looking for TAPI Programs as mentioned on https://learn.microsoft.com/en-us/windows/win32/tapi/tapi-quick-start

Specifically VB programs but cannot find any Samples anywhere, searched Incoming.cpp.

"Code Samples

The samples section of the Windows SDK contains fully compilable TAPI programs in C, C++, and Visual Basic. These samples can help you understand the various functions. The exact location of the material depends on whether you have a full installation. If you have difficulty locating them, try a search for Incoming.cpp."

Windows program files (x86) has the SDK folder but again no samples & pretty much scoured my whole drive.

If I could just get started, cannot initialize.

lineInitialize or lineInitializeEX

Windows 10, MSAccess 365 so Visual Basic.

Some powerBasic below, I know nothing about, seems to be there but I cannot work out how to do the CODEPTR(TapiCallback) part in VB.

'result = lineInitialize(lphLineApp, _

' ByVal 0, _

' ByVal CODEPTR(TapiCallback), _

' ByVal 0, _

' lpdwNumDevs


'Dim hLineApp As Long

'Dim numDevs As Long

'Dim i As Long

'Dim result As Long

'Dim hInstance As Long

'Dim lineCallback As Long

' ################### REMEMER TAPI Browser ############################

Dim result As Long

Dim lphLineApp As Integer

Dim hInstance As Integer

Dim lpfnCallback As Long

Dim lpszAppName As String

Dim lpdwNumDevs As Long

lpszAppName = "TAPI test"

' Initialize TAPI

' result = lineInitialize(lphLineApp, hInstance, lpfnCallback, lpszAppName, lpdwNumDevs)

'result = lineInitialize(lphLineApp, _

' ByVal 0, _

' ByVal CODEPTR(TapiCallback), _

' ByVal 0, _

' lpdwNumDevs)

'Declare Function lineInitialize Lib "tapi32.dll" (lphLineApp As Integer, ByVal hInstance As Integer,

' lpfnCallback As Long, ByVal lpszAppName As String, lpdwNumDevs As Long)

Dim i As Long

Dim hLineApp As Long

Dim numDevs As Long

'result = lineInitialize(hLineApp, 0, 0, 0, numDevs) ' failed to init

' result = lineInitialize(hLineApp, hInstance, lpfnCallback, lpszAppName, numDevs)

'result = lineInitialize(hLineApp, hInstance, lineCallback, "TAPI App", numDevs)

'Debug.Print hLineApp, hInstance, lineCallback, "TAPI App", numDevs

'Declare Function lineInitialize Lib "TAPI32.DLL" (ByRef hLineApp As Long, _

'ByVal hInstance As Long, ByVal lpfnCallBack As Long, _

'ByRef lpdwNumDevs As Long) As Long

'

'LONG lResult;

'LINEINITIALIZEEXPARAMS lineInit;

'HLINEAPP hLineApp = 0;

'DWORD dwApiVersion = 0x00020002;

'DWORD dwNumDevs = 0;

'HANDLE hTapiEvent = 0;

'

'memset( &lineInit;, 0, sizeof( lineInit ) );

'

'lineInit.dwTotalSize = sizeof( lineInit );

'lineInit.dwOptions = LINEINITIALIZEEXOPTION_USEEVENT;

'

'lResult = lineInitializeEx( &hLineApp;, //handle to TAPI - [out]

' NULL, //HINSTANCE of the application - [in]

' NULL, //pointer to callback function - [in]

' "TAPI App!", //friendly application name - [in]

' &dwNumDevs; ), //number of line devices on the system - [out]

' &dwApiVersion;, //highest API version supported by TAPI - [in, out]

' &lineInit; ); //pointer to LINEINITIALIZEEXPARAMS object - [in, out]

'Dim dwAPIVersion As String

'Dim lineInit As Long

'

'

'Dim lphLineApp As String

'Dim hInstance As String

'Dim lpfnCallback As String

'Dim lpszFriendlyAppName As String

'Dim lpdwNumDevs As String

'Dim lpdwAPIVersion As String

'Dim LINEINITIALIZEEXPARAMS

'result = lineInitializeEx(lphLineApp, hInstance, lpfnCallback, "TAPI App", lpdwNumDevs, lpdwAPIVersion, LINEINITIALIZEEXPARAMS)

'Declare Function lineInitializeEx Lib "TAPI32.DLL" Alias "lineInitializeExA" (ByVal lphLineApp _

' As String, ByVal hInstance As String, ByVal lpfnCallBack As String, _

' ByVal lpszFriendlyAppName As String, ByVal lpdwNumDevs As String, _

' ByVal lpdwAPIVersion As String, ByVal LINEINITIALIZEEXPARAMS) As Long

' declare function lineInitializeEx (ByVal lphLineApp As String, ByVal hInstance As Integer, ByVal lpfnCallback As Integer, ByVal lpszFriendlyAppName As String, ByRef lpdwNumDevs As Integer, ByRef lpdwAPIVersion As Integer, ByRef lpLineInitializeExParams As Integer) As long

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,717 questions
{count} votes

2 answers

Sort by: Most helpful
  1. RLWA32 46,581 Reputation points
    2025-01-21T12:53:22.31+00:00
    0 comments No comments

  2. Gregory Reed 0 Reputation points
    2025-01-22T08:51:50.6966667+00:00

    Many thanks, I searched everywhere & could not find.

    Bit of a rabbit hole though as completely different type of access to what I have been looking for & started to apply & so many compile issues, I could work them out but would take ages & still not know if work with current windows TAPI. I think I have to persist or give up on current track

    "Failed to initialize Tapi -Error -2147483595"

    result = lineInitialize(hLineApp, hInstance, lpfnCallback, lpszAppName, lpdwNumDevs)

    'Declare Function lineInitialize Lib "TAPI32.DLL" (ByRef hLineApp As Long, _

    'ByVal hInstance As Long, ByVal lpfnCallback As Long, ByVal lpszAppName As String, _

    'ByRef lpdwNumDevs As Long) As Long

    lpCallback has to be some kind of function but can't find VBA examples

    There is v.old powerbasic code but I cannot translate.

    I think it is actually a call to windows notifications

    Thanks anyway, I guess that was what I saw in the learn ref. samples but that page was referring to LineInitialize.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.