
Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks peter. . . Yeah, I had reviewed that.
Unfortunately the two examples he uses there involve notify the asp.net
application from a web page (why that is important, I dont know)
I'm stuck
> Hi,
>
[quoted text clipped - 10 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 27 Feb 2006 07:44 GMT
Hi
Based on my test, it seems that we can fire the event from Web Page to
Winform.
But we need to config the Subcriptorclass as a Library.
Based on the Sample I send to you in the newsgroup link.
1. unregister the Subcriptor class, regsvcs /u
2. Add an event in the Subcriptor and regsvcs Subcriptor.dll
Public Class Subcriptor
Inherits ServicedComponent
Implements EventClass.IEventosPedidos
Public Event TestEvent()
Public Sub PedidoRealizado(ByVal IdPedido As Integer) Implements
EventClass.IEventosPedidos.PedidoRealizado
Debug.WriteLine("Pedido " & IdPedido & " realizado")
RaiseEvent TestEvent()
End Sub
End Class
3. Code in the winform, now if we click the button, the msgbox will be
popup which means the LCE works OK.
Dim WithEvents s As Subscriptor.Subcriptor = New Subscriptor.Subcriptor
Dim st As New SubscripcionesTransitorias
Dim Id As String
Dim p As EventClass.IEventosPedidos = New EventClass.EventosPedidos
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Id = st.A?adir(s)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
p.PedidoRealizado(1)
End Sub
Private Sub s_TestEvent() Handles s.TestEvent
MsgBox("Hello")
End Sub
4. Add an asp.net page to fire the LCE event in codebehind
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim p As EventClass.IEventosPedidos = New EventClass.EventosPedidos
p.PedidoRealizado(1)
End Sub
Now if we click the Asp.NET button in web form the msgbox in winform will
be pop up.
The key point here is that we need to registered the Subcriptor as Library.
So that the .NET Event will be hosted in the same process where the winform
is.
If we run the Subcriptor Server, the Subcriptor will run in another
process. Because the .NET Event( which is different from the LCE event) is
similar with a function point(memory address). the function point will have
no sense in another process.
Hope this helps.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.