R
Richard
See '###PROBLEM### below
Public Class Form1
Public Interface INotify
Function GetHandle() As System.IntPtr 'Not sure if I should do
this because it
'requires the client to remember to put the code
'in GetHandle and to call IsHandleCreated!
Sub NotifyClient(ByVal Text As String) 'For example
End Interface
Private m_Notify() as INotify
Public Sub Subscribe(TheForm As INotify)
'Adds TheForm to the m_Notify array
End Sub
Private Sub tmrNotify_OnTimer(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles tmrNotify.Tick
'Loops through all objects in m_Notify and calls the NotifyClient
function.
'### PROBLEM ###
'The m_Clients(n).NotifyClient(text) function will be called even if
the client no longer exists. I cannot figure out how to get the handle
of the form that implimented INotify. I can only guess that I have to
use the implimented GetHandle function to check.. but it requires the
client to have the proper code.
End Sub
End Class
Public Class Form2
'Do I really have to do this?
Public Function GetHandle() As System.IntPtr Implements
INotify.GetHandle
If Me.IsHandleCreated() Then
Return Me.Handle
Else
Return 0
End If
End Function
Public Sub NotifyClient(ByVal Text As String) Impliments
INotify.NotifyClient
'
End Sub
End Class
Thanks in advance
Public Class Form1
Public Interface INotify
Function GetHandle() As System.IntPtr 'Not sure if I should do
this because it
'requires the client to remember to put the code
'in GetHandle and to call IsHandleCreated!
Sub NotifyClient(ByVal Text As String) 'For example
End Interface
Private m_Notify() as INotify
Public Sub Subscribe(TheForm As INotify)
'Adds TheForm to the m_Notify array
End Sub
Private Sub tmrNotify_OnTimer(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles tmrNotify.Tick
'Loops through all objects in m_Notify and calls the NotifyClient
function.
'### PROBLEM ###
'The m_Clients(n).NotifyClient(text) function will be called even if
the client no longer exists. I cannot figure out how to get the handle
of the form that implimented INotify. I can only guess that I have to
use the implimented GetHandle function to check.. but it requires the
client to have the proper code.
End Sub
End Class
Public Class Form2
'Do I really have to do this?
Public Function GetHandle() As System.IntPtr Implements
INotify.GetHandle
If Me.IsHandleCreated() Then
Return Me.Handle
Else
Return 0
End If
End Function
Public Sub NotifyClient(ByVal Text As String) Impliments
INotify.NotifyClient
'
End Sub
End Class
Thanks in advance