Does anyone can tell me how to use COM component in Web
Application in ASP.NET with VB?
Now I have to use a third-party COM component(CCNSMTLib) in
my project to play a wave file and send it out to different
IP phones.
It works fine in windows application in ASP.NET, but when
I convert the code into web application, it does not work.
When I click the "Start" button in web application, the Web
Page is freezing for ever. When I set breakpoint to debug, the program is block at the statement "Dim obj As New CCNMediaTerm".
Following is the code for windows application:
========================================================
Imports CCNSMTLib
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Start_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim obj As New CCNMediaTerm
Dim mfpp As UInt16
mfpp = System.Convert.ToUInt16(0)
Dim sendFileCookie As Integer
Call obj.Initialize()
Call obj.SetAudioCodecTX(4, 20, 0, 0, mfpp, 0)
Call obj.SetAudioDestination("172.20.10.138", 30000)
Dim waveDevice, mode, volume As UInt32
waveDevice = System.Convert.ToUInt32(-1)
mode = System.Convert.ToUInt32(1)
volume = System.Convert.ToUInt32(80)
obj.StartTX(waveDevice)
obj.StartPlayingFileTX("C:\system_error.wav", _
mode, volume, sendFileCookie)
End Sub
End Class
===========================================================
Following is the code for Web Application
===========================================================
Imports CCNSMTLib
Public Class rtpPlay
Inherits System.Web.UI.Page
Private Sub Start_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1_Start.Click
Dim obj As New CCNMediaTerm
Dim mfpp As UInt16
mfpp = System.Convert.ToUInt16(0)
Dim sendFileCookie As Integer
Call obj.Initialize()
Call obj.SetAudioCodecTX(4, 20, 0, 0, mfpp, 0)
Call obj.SetAudioDestination("172.20.10.138", 30000)
Dim waveDevice, mode, volume As UInt32
waveDevice = System.Convert.ToUInt32(-1)
mode = System.Convert.ToUInt32(1)
volume = System.Convert.ToUInt32(80)
obj.StartTX(waveDevice)
obj.StartPlayingFileTX("C:\system_error.wav", _
mode, volume, sendFileCookie)
End Sub
Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
End Class
============================================================
Application in ASP.NET with VB?
Now I have to use a third-party COM component(CCNSMTLib) in
my project to play a wave file and send it out to different
IP phones.
It works fine in windows application in ASP.NET, but when
I convert the code into web application, it does not work.
When I click the "Start" button in web application, the Web
Page is freezing for ever. When I set breakpoint to debug, the program is block at the statement "Dim obj As New CCNMediaTerm".
Following is the code for windows application:
========================================================
Imports CCNSMTLib
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Start_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim obj As New CCNMediaTerm
Dim mfpp As UInt16
mfpp = System.Convert.ToUInt16(0)
Dim sendFileCookie As Integer
Call obj.Initialize()
Call obj.SetAudioCodecTX(4, 20, 0, 0, mfpp, 0)
Call obj.SetAudioDestination("172.20.10.138", 30000)
Dim waveDevice, mode, volume As UInt32
waveDevice = System.Convert.ToUInt32(-1)
mode = System.Convert.ToUInt32(1)
volume = System.Convert.ToUInt32(80)
obj.StartTX(waveDevice)
obj.StartPlayingFileTX("C:\system_error.wav", _
mode, volume, sendFileCookie)
End Sub
End Class
===========================================================
Following is the code for Web Application
===========================================================
Imports CCNSMTLib
Public Class rtpPlay
Inherits System.Web.UI.Page
Private Sub Start_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1_Start.Click
Dim obj As New CCNMediaTerm
Dim mfpp As UInt16
mfpp = System.Convert.ToUInt16(0)
Dim sendFileCookie As Integer
Call obj.Initialize()
Call obj.SetAudioCodecTX(4, 20, 0, 0, mfpp, 0)
Call obj.SetAudioDestination("172.20.10.138", 30000)
Dim waveDevice, mode, volume As UInt32
waveDevice = System.Convert.ToUInt32(-1)
mode = System.Convert.ToUInt32(1)
volume = System.Convert.ToUInt32(80)
obj.StartTX(waveDevice)
obj.StartPlayingFileTX("C:\system_error.wav", _
mode, volume, sendFileCookie)
End Sub
Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
End Class
============================================================