Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

TAPI - VISUAL BASIC ACCESS

2 réponses
Avatar
viny
Bonjour,

J'essaie tout simplement de récupérer les infos d'un appel entrant (Numéro
CLIP) et de décrocher l'appel automatiquement.

Lorsque je récupère un événement TAPI (TE_CALLNOTIFICATION) pEvent contient
un objet ITCallNotificationEvent que je suis censé casté en
ITBasicCallControl. Cfr example de microsoft
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tapi3/receive_a_call.asp

mais je recois l'erreur type mismatch

Toutes les idées sont les biens venues....

example de mon code ci-dessous:

Private Sub gobjTAPIWithEvents_event(ByVal TapiEvent As TAPI_EVENT, ByVal
pEvent As Object)
Dim objCallNotificationEvent As ITCallNotificationEvent
Dim gobjReceivedCallInfo As ITCallInfo
Dim objCallControl As ITBasicCallControl
Dim cne As CALL_NOTIFICATION_EVENT



Select Case TapiEvent

Case TE_CALLNOTIFICATION
Set objCallNotificationEvent = pEvent
Set gobjReceivedCallInfo = objCallNotificationEvent.Call

MsgBox ( _
gobjReceivedCallInfo.CallInfoString(CIS_CALLEDIDNUMBER) & _
Space(1) & _
gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNUMBER) & _
Space(1) & _
gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNAME) _
)

' Get the ITBasicCallControl interface.
Set objCallControl = gobjReceivedCallInfo
!!!! sur cette instruction je recois type mismatch !!!

' At last ,system will raise event of 'TE_CALLSTATE',you
' can answer the call at it.
objCallControl.Answer


End Select

End Sub

2 réponses

Avatar
Jean Elens
Pourquoi redéfinis tu ainsi un nouvel objet "de meme type" ?

Set gobjReceivedCallInfo = objCallNotificationEvent.Call
et
Set objCallControl = gobjReceivedCallInfo

essaie de faire
Set objCallControl =objCallNotificationEvent.Call

ou de réutiliser le premier (gobjReceivedCallInfo) ? non ?



-------------
Private Sub gobjTAPIWithEvents_event(ByVal TapiEvent As TAPI_EVENT, ByVal
pEvent As Object)
Dim objCallNotificationEvent As ITCallNotificationEvent
Dim gobjReceivedCallInfo As ITCallInfo
Dim objCallControl As ITBasicCallControl
Dim cne As CALL_NOTIFICATION_EVENT



Select Case TapiEvent

Case TE_CALLNOTIFICATION
Set objCallNotificationEvent = pEvent
Set gobjReceivedCallInfo = objCallNotificationEvent.Call

MsgBox ( _
gobjReceivedCallInfo.CallInfoString(CIS_CALLEDIDNUMBER) &


_
Space(1) & _
gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNUMBER) &


_
Space(1) & _
gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNAME) _
)

' Get the ITBasicCallControl interface.
Set objCallControl = gobjReceivedCallInfo
!!!! sur cette instruction je recois type mismatch !!!

' At last ,system will raise event of 'TE_CALLSTATE',you
' can answer the call at it.
objCallControl.Answer


End Select

End Sub



Avatar
viny
bien sur j'ai déjà essayé... l'erreur est la même... il n'accepte pas de
caster un objet ITCallNotificationEvent en un objet ITBasicCallControl, le
compilateur me dit: "Type mismatch"

Hors à priori c'est la seul manière de prendre "la main" sur un appel
entrant ... Cfr example de m$:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tapi3/receive_a_call.asp

Je me demande si les castings sont possibles en VB ... ?

Si oui pq refuse-t-il de caster c'est deux objets comme dans l'example M$ ...

"Jean Elens" a écrit :

Pourquoi redéfinis tu ainsi un nouvel objet "de meme type" ?

Set gobjReceivedCallInfo = objCallNotificationEvent.Call
et
Set objCallControl = gobjReceivedCallInfo

essaie de faire
Set objCallControl =objCallNotificationEvent.Call

ou de réutiliser le premier (gobjReceivedCallInfo) ? non ?



-------------
> Private Sub gobjTAPIWithEvents_event(ByVal TapiEvent As TAPI_EVENT, ByVal
> pEvent As Object)
> Dim objCallNotificationEvent As ITCallNotificationEvent
> Dim gobjReceivedCallInfo As ITCallInfo
> Dim objCallControl As ITBasicCallControl
> Dim cne As CALL_NOTIFICATION_EVENT
>
>
>
> Select Case TapiEvent
>
> Case TE_CALLNOTIFICATION
> Set objCallNotificationEvent = pEvent
> Set gobjReceivedCallInfo = objCallNotificationEvent.Call
>
> MsgBox ( _
> gobjReceivedCallInfo.CallInfoString(CIS_CALLEDIDNUMBER) &
_
> Space(1) & _
> gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNUMBER) &
_
> Space(1) & _
> gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNAME) _
> )
>
> ' Get the ITBasicCallControl interface.
> Set objCallControl = gobjReceivedCallInfo
> !!!! sur cette instruction je recois type mismatch !!!
>
> ' At last ,system will raise event of 'TE_CALLSTATE',you
> ' can answer the call at it.
> objCallControl.Answer
>
>
> End Select
>
> End Sub
>