void MakeTapiCall(_bstr_t &bstrLine, _bstr_t &bstrNumber) { ULONG ul; _bstr_t name; HRESULT hr; ITTAPIPtr pTapi; ITAddressPtr pAddress; IEnumAddressPtr pEnumAddress; ITBasicCallControlPtr pCall; // Initialize TAPI hr = pTapi.CreateInstance(CLSID_TAPI); hr = pTapi->Initialize(); // Look for the requested line pEnumAddress = pTapi->EnumerateAddresses(); while ( pEnumAddress->Next(1, &pAddress, &ul) == S_OK ) { name = pAddress->AddressName; if ( name == bstrLine ) break; pAddress.Release(); pAddress = 0; } // If the line was found, then make a call if ( pAddress ) { pCall = pAddress->CreateCall(bstrNumber, LINEADDRESSTYPE_PHONENUMBER, TAPIMEDIATYPE_AUDIO); // Make the call hr = pCall->Connect(true); // Wait a while - do something sensible here // while the call is ongoing Sleep(10000); // This isn't all that sensible // Hangup hr = pCall->Disconnect(DC_NORMAL); } // Shutdown TAPI hr = pTapi->Shutdown(); pTapi.Release(); } int main() { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); MakeTapiCall( _bstr_t("56Kbps Internal Modem"), _bstr_t("2017773456") ); CoUninitialize(); }