Here are two classes in two different file documents. The first class
FormWin_Status_Of_System_And_Ports creates threads for each telephone line
(each thread is the 2nd class Class_Telephony_Toolkit). The 2nd class has a
sub new, that the 1st class uses to pass arguments. It has worked fine, but
seems contrary to the documentation. The lines of interest are marked by
*****, if you want to search on that.
Thanks!
Bob Day
Friend Class FormWin_Status_Of_System_And_Ports
Inherits System.Windows.Forms.Form
Private Sub Thread_Start_Each_Trunk()
' Purpose: This starts 1 thread per trunk (ie port or talk path). If the
system has 1 card with 4 talk paths (4 RJ 11 modular plugs or 2 RJ14 modular
plugs), will will create 4 threads. These threads stay active until reboot,
in which case they are created again. Each thread contains all of the
telephony methods, like play, get digits, etc. Remember, first Trunk is 0,
last Trunk is 'total -1'
' start at 1st possible trunk which is zero
Dim This_Trunk_0_Based As Integer = 0
' holds last trunk zero based (2 trunks total, 0, 1, would hold 1)
Dim Last_Trunk_0_Based As Integer = -1
' load value
Last_Trunk_0_Based = gsTotal_Useable_Trunks - 1
' hold contents of app.config (true or false)to display CTADE Pop Up Errors
Dim PopUp_Error_Displayed As Boolean
' hold contents of app.config (Enabled, Detailed, Disabled)to CTADE log
Dim Set_Log_Level As String
' get value from app.config
PopUp_Error_Displayed = CBool(App_Config.PopUp_Error_Displayed_Get())
' get value from app.config
Set_Log_Level = App_Config.Set_Log_Level_Get
Do
' create array to hold a thread class instance per trunk
' Instantiate variable Array
Dim Thread_Trunk_Array(This_Trunk_0_Based) As Class_Telephony_Toolkit
' ***** note that the argumens are bing passed via the sub new
' Fill array, note that this instantiates Class
Thread_Trunk_Array(This_Trunk_0_Based) = New
Class_Telephony_Toolkit(This_Trunk_0_Based, PopUp_Error_Displayed, Set_Log_L
evel)
' start the thread
Thread_Trunk_Array(This_Trunk_0_Based).Thread_Trun kA_Start()
' increment up 1 for next trunk (if any)
This_Trunk_0_Based += 1
' repeat for each trunk
Loop Until This_Trunk_0_Based > Last_Trunk_0_Based
' start up stops running here, threads are now running (trunk threads
waiting for call)
End Sub
End Class
----------------------------------------------------------------------------
------------------------
Public Class Class_Telephony_Toolkit
' This class contains all methods, events & Properties available through
Intel's Parity's VoiceBocxLib Telephony Tool kit. Each trunk instantiates
this class to handle that one trunk.
Public Sub New(ByVal This_Trunk_0_Based As Integer, ByVal
CTADE_PopUp_Error_Displayed As Boolean, ByVal CTADE_Set_Log_Level As String)
' *********code to load passed arguments to variables
End Sub
end class
"Peter Huang" <v-******@online.microsoft.com> wrote in message
news:8Y****************@cpmsftngxa07.phx.gbl...
Hi Bob,
As far as I know, Thead.New need an ThreadStart delegate, while a
ThreadStart Delegate can not take argument.
Initializes a new instance of the Thread class.
[Visual Basic]
Public Sub New( _
ByVal start As ThreadStart _
)
http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemthreadingthreadclassctortopic.asp
ThreadStart Delegate
Represents the method that executes on the Thread.
[Visual Basic]
<Serializable>
Public Delegate Sub ThreadStart()
http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemthreadingthreadstartclasstopic.asp
Can you show me your code?
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.