Le jeudi 29 octobre 2015 08:04:23 UTC+1, Christophe a écrit :
> HI, first sorry for my english because i'm french.
>
> I've found a code to get caller id in vba/access from YIS.
>
> In the register sub the code find anything except the 5 ports i have on my box (sfr).
> each address are equal to 0. I don't know why. So I can't find the caller id event.
> If someone could help me, it would be very great.
>
> hello yisman i did a copy of your code about call id in vba access 2007 (just below). The code detects well 5 addresses in the sub(register) ( but there are all to nothing, so program stop it. if you or everybody could halp me it wille be great.
Public Montapi
Public Montapi
'Here is the entire code as is. My greatest appreciation to all who are
Option Explicit
Const MediaAudio As Integer = 8
Const MediaModem As Integer = 16
Const MediaFax As Integer = 32
Const MediaVideo As Long = 32768
Public WithEvents oTAPI As TAPI3Lib.TAPI ' will hold our TAPI object
'Private oAddress As ITAddress ' will hold our selected address (you can
'hold many address in an array)
Private RegCookie As Integer
Private CallNotificationObject As ITCallNotificationEvent
Private CallStateObject As ITCallStateEvent
Private CallInfoObject As ITCallInfoChangeEvent
Private CurrentCallerID As String
Dim MediaTypes As Long
' property let NewTAPI as TAPI3Lib.TAPI
'Public Property Let NewTAPI(objTapi As TAPI)
'Set oTAPI = objTapi
'Setup
'End Property
'Public Property Get NewTAPI() As TAPI3Lib.TAPI
'Set NewTAPI = oTAPI
'End Property
Public Sub Setup()
Debug.Print "Registered at " & Time()
Dim MediaSupport As ITMediaSupport
Set MediaSupport = Address ' extracting media support interface
'from the address
MediaTypes = MediaSupport.MediaTypes ' extracting media types
'supporting
Set MediaSupport = Nothing ' dispose of the object
If (MediaTypes And MediaModem) = MediaModem Then
If (MediaTypes And MediaAudio) = MediaAudio Then
Set oAddress = Address ' select this address
Exit For
End If
End If
End If
Next Address
If oAddress Is Nothing Then Exit Sub
Debug.Print "Registered at " & Time()
RegCookie = oTAPI.RegisterCallNotifications(oAddress, True, False, MediaTypes, 1)
oTAPI.EventFilter = (1 Or 2 Or 4 Or 8 Or 16 Or 32 Or 64 Or 128 Or 256 Or 512 Or 1024 Or 2048 Or 4096 Or 8192 Or 16384 Or 32768 Or 65536 Or 131072 Or 262144 Or 524288 Or 1048576 Or 2097152 Or 4194304 Or 8388608 Or 16777216 Or 33554432)
End Sub
Sub Initialize()
Dim m_TAPI As New TAPI
m_TAPI.Initialize
Set oTAPI = m_TAPI
Set m_TAPI = Nothing
End Sub
'
Option Explicit
Const MediaAudio As Integer = 8
Const MediaModem As Integer = 16
Const MediaFax As Integer = 32
Const MediaVideo As Long = 32768
Public WithEvents oTAPI As TAPI3Lib.TAPI ' will hold our TAPI object
'Private oAddress As ITAddress ' will hold our selected address (you can
'hold many address in an array)
Private RegCookie As Integer
Private CallNotificationObject As ITCallNotificationEvent
Private CallStateObject As ITCallStateEvent
Private CallInfoObject As ITCallInfoChangeEvent
Private CurrentCallerID As String
Dim MediaTypes As Long
' property let NewTAPI as TAPI3Lib.TAPI
'Public Property Let NewTAPI(objTapi As TAPI)
'Set oTAPI = objTapi
'Setup
'End Property
'Public Property Get NewTAPI() As TAPI3Lib.TAPI
'Set NewTAPI = oTAPI
'End Property
Public Sub Setup()
Debug.Print "Registered at " & Time()
Dim MediaSupport As ITMediaSupport
Set MediaSupport = Address ' extracting media support interface