TAPI Wrapper (part 2)

T

Thomas Hall

I've written a class to monitor and log unanswered incoming voice calls
on a Pocket PC 2003 Phone Edition (WinCE 4.2). I'm using Alex
Feinman's Tapi wrapper (v.1.6). We have been field-testing the new
class this past week and randomly we are seeing a TapiException
(OpenNETCF.Tapi.TapiException) which is trashing the EXE process. This
is confusing since I am catching this error type in my handler.

For example:
Private Sub m_objCall_CallInfo(ByVal [Call] As OpenNETCF.Tapi.Call,
_
ByVal infoState As OpenNETCF.Tapi.LINECALLINFOSTATE, _
ByVal info As OpenNETCF.Tapi.LINECALLINFO) Handles
m_objCall.CallInfo
Try
If m_bGetCallInfo AndAlso [Call] Is m_objCall Then
m_bGetCallInfo = False
If m_objCall.Info.dwOrigin = LINECALLORIGIN.INBOUND
Then
Dim strCallerID As String
If m_objCall.Info.CallerID.Trim <> String.Empty
Then
strCallerID = m_objCall.Info.CallerID.Trim
Else
strCallerID = "Unknown"
End If
m_strLastCallerID = strCallerID
End If
If m_objCall.Info.dwOrigin = LINECALLORIGIN.OUTBOUND
Then
Dim strCalledID As String
If m_objCall.Info.CalledID.Trim <> String.Empty
Then
strCalledID = m_objCall.Info.CalledID.Trim
Else
strCalledID = "Unknown"
End If
m_strLastCalledID = strCalledID
End If
End If

Catch exTapi As OpenNETCF.Tapi.TapiException
' Log error here.

Catch ex As Exception
' Log error here.

End Try
End Sub

Any ideas?

Regards,
Thomas
 
N

Nathan Franklin

An idea, perhaps im wrong, but check to see what thread the exception is
coming from. I know the RAPI class provided by OpenNETCF throws exceptions
in worker threads which are uncatchable. I jumped into the RAPI code where
the thread was throwing the exceptions and commented it out and instead
handled them a little differently.

HTH

Nathan
 
T

Thomas Hall

Alex,

Since the TapiException is not being caught in my Try...Catch here are
the error details as displayed in the WinForms unhandled exceptions
dialog:

-------
Error
-------
MyProgram.exe
TapiException

Call::LoadCallInfo+0x48
Call::OnLineCallInfo+0x13
Tapi::OnLineCallInfo+0x7d
Tapi::TapiThreadProc+0x51

-------

I appreciate your help on this.

Regards,
Thomas
 
T

Thomas Hall

I cannot catch OpenNETCF.Tapi.NativeTapi in my Try...Catch since it
does not inherit from System.Exception. Is there another way to do
this?
 
T

Thomas Hall

I must be too busy -- I left out the first part of my previous post:

I added a Try...Catch around my application's entry point to inspect
the TapiException.NativeError.
Here's the code:

Public Sub Main()
Try
SubMain()

Catch exTapi As OpenNETCF.Tapi.TapiException
MessageBox.Show("TapiException: " & exTapi.Message & vbCrLf
& "NativeError: " & exTapi.NativeError.ToString)

Catch ex As Exception
MessageBox.Show("Unhandled Exception: " & ex.Message)

End Try
End Sub

I was not able to catch the TapiException and instead the WinForms
error dialog displayed the same call stack info as before.

I looked at the OpenNETCF.Tapi.NativeTapi object to see if it would
help and since it does not inherit from System.Exception there is no
way for me to catch it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top