By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,837 Members | 1,842 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,837 IT Pros & Developers. It's quick & easy.

Windows Services & .NET Controls

P: n/a
Hi,
I'm currently stuck with a big problem. I must develop a Windows service
and an application to configure it and display what is happening. The
problem is not really on the service side, but on the application side. I
explain:

The service is composed of a kernel dynamicaly loading plug-ins modules and
starts the process of each module. Until nous, it's not that hard.

The hard part is when it comes to the application to configure the service
and display what is happening. Each module has it's own configuration panel
and it's own display panel. I'm not that familiar with which information I
can pass from my service to my application, so I need to know if there is a
way I can pass an instance of a control from my service to my application
and how can I do it? I've been searching all over the net to find it, but it
seems nobody ever did it (or they didn't put the solution on the net)

And I would have something else. In fact I would like to have the opinion of
someone else on that. My software is designed that way :

Module1 ---- ---- Module2
\ /
Module3 ----Kernel ---- Module4
/ \
Module5 ---- ---- Module6

Service ----Using----- Kernel

Application ----Communicating With ---- Service

Application ----Displays---- ModuleX.ConfigurationPanel or
ModuleX.ActionPanel that came from the Service

First of all, would anyone see a better design involving a service for
displaying the information? if you do, what is it and why(if possible)?

thanks

ThunderMusic

P.S. Sorry for the other post, I just did not verify the subject before
sending... ;)

Jul 21 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
you can use the remoting solution.

[]'s
Sushi
Jul 21 '05 #2

P: n/a
But you'd have to implement ISerializable on the controls...

"Sushi" <su********@terra.com.br> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...
you can use the remoting solution.

[]'s
Sushi

Jul 21 '05 #3

P: n/a
ok, do you have an example of this? is it available on MSDN?

Thanks a lot, it gives me a hint for where to begin... ;)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
But you'd have to implement ISerializable on the controls...

"Sushi" <su********@terra.com.br> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...
you can use the remoting solution.

[]'s
Sushi


Jul 21 '05 #4

P: n/a
ok, after checking on MSDN, I found something about MarshalByReference and I
think it could be useful, but there are no example of how it can be used
(well, I didn't find one). So I cannot say if this is the thing I need. Does
someone know about an example?

thanks

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le message de
news:ua**************@TK2MSFTNGP09.phx.gbl...
ok, do you have an example of this? is it available on MSDN?

Thanks a lot, it gives me a hint for where to begin... ;)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
But you'd have to implement ISerializable on the controls...

"Sushi" <su********@terra.com.br> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...
you can use the remoting solution.

[]'s
Sushi



Jul 21 '05 #5

P: n/a
You can't use MarhalByRef in your example. The root of the object
inheritance chain would have to be MarshalByRef, and Control is not. That's
why you' have to implement ISerializable, in order to control the
serialization process.

Have a look at:
http://samples.gotdotnet.com/quickst...ializable.aspx
for an example

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
ok, after checking on MSDN, I found something about MarshalByReference and
I
think it could be useful, but there are no example of how it can be used
(well, I didn't find one). So I cannot say if this is the thing I need.
Does
someone know about an example?

thanks

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le message
de
news:ua**************@TK2MSFTNGP09.phx.gbl...
ok, do you have an example of this? is it available on MSDN?

Thanks a lot, it gives me a hint for where to begin... ;)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
> But you'd have to implement ISerializable on the controls...
>
> "Sushi" <su********@terra.com.br> wrote in message
> news:Oo**************@TK2MSFTNGP12.phx.gbl...
> > you can use the remoting solution.
> >
> > []'s
> > Sushi
> >
> >
>
>



Jul 21 '05 #6

P: n/a
ok, but the controls I use are always controls à created, so can I make them
inherit from MarshalByRefObject? and then use them that way?

thanks a lot
"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
You can't use MarhalByRef in your example. The root of the object
inheritance chain would have to be MarshalByRef, and Control is not. That's why you' have to implement ISerializable, in order to control the
serialization process.

Have a look at:
http://samples.gotdotnet.com/quickst...ializable.aspx
for an example

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
ok, after checking on MSDN, I found something about MarshalByReference and I
think it could be useful, but there are no example of how it can be used
(well, I didn't find one). So I cannot say if this is the thing I need.
Does
someone know about an example?

thanks

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le message
de
news:ua**************@TK2MSFTNGP09.phx.gbl...
ok, do you have an example of this? is it available on MSDN?

Thanks a lot, it gives me a hint for where to begin... ;)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
> But you'd have to implement ISerializable on the controls...
>
> "Sushi" <su********@terra.com.br> wrote in message
> news:Oo**************@TK2MSFTNGP12.phx.gbl...
> > you can use the remoting solution.
> >
> > []'s
> > Sushi
> >
> >
>
>



Jul 21 '05 #7

P: n/a
Will this serialisation allow me to pass the control from my service to the
application or will I need to create an instance of the control in my app
and get the informations to display what I need to display from the service?
I mean, to get a reference to the existing control from the service would be
much more efficient, if it can be done.

I don't understand much about the serialisation in this case and/or
MarshalByRefObject. I don't know the differences and if one or the other can
be used considering all the controls used will be made by me, so they can
inherit from both (or can't they?)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
You can't use MarhalByRef in your example. The root of the object
inheritance chain would have to be MarshalByRef, and Control is not. That's why you' have to implement ISerializable, in order to control the
serialization process.

Have a look at:
http://samples.gotdotnet.com/quickst...ializable.aspx
for an example

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
ok, after checking on MSDN, I found something about MarshalByReference and I
think it could be useful, but there are no example of how it can be used
(well, I didn't find one). So I cannot say if this is the thing I need.
Does
someone know about an example?

thanks

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le message
de
news:ua**************@TK2MSFTNGP09.phx.gbl...
ok, do you have an example of this? is it available on MSDN?

Thanks a lot, it gives me a hint for where to begin... ;)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
> But you'd have to implement ISerializable on the controls...
>
> "Sushi" <su********@terra.com.br> wrote in message
> news:Oo**************@TK2MSFTNGP12.phx.gbl...
> > you can use the remoting solution.
> >
> > []'s
> > Sushi
> >
> >
>
>



Jul 21 '05 #8

P: n/a
Serialization and MarshalByRef are two different ways to access objects
from a different AppDomain (or "process").

Serialization is like passing an object ByVal - the contents is copied
from one process to the other, so that the object can be re-created in
the calling process.

MarshalByRef is like passing an object ByVal - a reference is copied
from one process to the other, and a proxy object is created in the
calling process. The client application has a reference to the proxy
object. Any calls to methods/properties on the "proxy" object in the
client get serialized and passed to the "real" object running in the
server process. The server object performs the work and then serializes
any return value to pass back to the proxy and the calling client code.

I think for the application you are trying to create, you would be
better off using MarshalByRef. However, you do not necessarily have to
make your existing objects/controls MarshalByRef. It might be a better
design to create monitoring objects designed specifically for this
purpose. They will inherit from MarshalByRef, and their methods will be
designed not to chatty. They expose a simple interface that doesn't
require a lot of serialization for the method parameters or return
values. The implementation of the methods handles all of the
communication with the real controls you are trying to monitor, running
in the service.

Take a little time to familiarize yourself with remoting before diving
into a solution. Do a google search for ".net remoting" and you should
find a number of good articles that explain the hows and whys. If you
have the time for a book, check out Rocky Lhotka's "Expert One-on-One
Visual Basic .NET Business Objects".

-Joshua Flanagan
ThunderMusic wrote:
Will this serialisation allow me to pass the control from my service to the
application or will I need to create an instance of the control in my app
and get the informations to display what I need to display from the service?
I mean, to get a reference to the existing control from the service would be
much more efficient, if it can be done.

I don't understand much about the serialisation in this case and/or
MarshalByRefObject. I don't know the differences and if one or the other can
be used considering all the controls used will be made by me, so they can
inherit from both (or can't they?)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
You can't use MarhalByRef in your example. The root of the object
inheritance chain would have to be MarshalByRef, and Control is not.


That's
why you' have to implement ISerializable, in order to control the
serialization process.

Have a look at:
http://samples.gotdotnet.com/quickst...ializable.aspx
for an example

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl.. .
ok, after checking on MSDN, I found something about MarshalByReference
and
I
think it could be useful, but there are no example of how it can be used
(well, I didn't find one). So I cannot say if this is the thing I need.
Does
someone know about an example?

thanks

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le message
de
news:ua**************@TK2MSFTNGP09.phx.gbl...

ok, do you have an example of this? is it available on MSDN?

Thanks a lot, it gives me a hint for where to begin... ;)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...

>But you'd have to implement ISerializable on the controls...
>
>"Sushi" <su********@terra.com.br> wrote in message
>news:Oo**************@TK2MSFTNGP12.phx.gbl. ..
>
>>you can use the remoting solution.
>>
>>[]'s
>>Sushi
>>
>>
>
>


Jul 21 '05 #9

P: n/a
No you can't. The base Control class itself is not a MarshalByRef object. If
you inherit from MarshalByRefObject then your class is not a control. If you
inherit from Control (or any of it's child classes) you're root object is
Object not MarshalByRefObject.

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:uy*************@TK2MSFTNGP12.phx.gbl...
ok, but the controls I use are always controls à created, so can I make
them
inherit from MarshalByRefObject? and then use them that way?

thanks a lot
"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
You can't use MarhalByRef in your example. The root of the object
inheritance chain would have to be MarshalByRef, and Control is not.

That's
why you' have to implement ISerializable, in order to control the
serialization process.

Have a look at:
http://samples.gotdotnet.com/quickst...ializable.aspx
for an example

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> ok, after checking on MSDN, I found something about MarshalByReference and > I
> think it could be useful, but there are no example of how it can be
> used
> (well, I didn't find one). So I cannot say if this is the thing I need.
> Does
> someone know about an example?
>
> thanks
>
> "ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le
> message
> de
> news:ua**************@TK2MSFTNGP09.phx.gbl...
>> ok, do you have an example of this? is it available on MSDN?
>>
>> Thanks a lot, it gives me a hint for where to begin... ;)
>>
>> "Sean Hederman" <us***@blogentry.com> a écrit dans le message de
>> news:cv**********@ctb-nnrp2.saix.net...
>> > But you'd have to implement ISerializable on the controls...
>> >
>> > "Sushi" <su********@terra.com.br> wrote in message
>> > news:Oo**************@TK2MSFTNGP12.phx.gbl...
>> > > you can use the remoting solution.
>> > >
>> > > []'s
>> > > Sushi
>> > >
>> > >
>> >
>> >
>>
>>
>
>



Jul 21 '05 #10

P: n/a
thanks a lot... now it's clear... ;)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
No you can't. The base Control class itself is not a MarshalByRef object. If you inherit from MarshalByRefObject then your class is not a control. If you inherit from Control (or any of it's child classes) you're root object is
Object not MarshalByRefObject.

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:uy*************@TK2MSFTNGP12.phx.gbl...
ok, but the controls I use are always controls à created, so can I make
them
inherit from MarshalByRefObject? and then use them that way?

thanks a lot
"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
You can't use MarhalByRef in your example. The root of the object
inheritance chain would have to be MarshalByRef, and Control is not.

That's
why you' have to implement ISerializable, in order to control the
serialization process.

Have a look at:
http://samples.gotdotnet.com/quickst...ializable.aspx
for an example

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> ok, after checking on MSDN, I found something about MarshalByReference
and
> I
> think it could be useful, but there are no example of how it can be
> used
> (well, I didn't find one). So I cannot say if this is the thing I

need. > Does
> someone know about an example?
>
> thanks
>
> "ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le
> message
> de
> news:ua**************@TK2MSFTNGP09.phx.gbl...
>> ok, do you have an example of this? is it available on MSDN?
>>
>> Thanks a lot, it gives me a hint for where to begin... ;)
>>
>> "Sean Hederman" <us***@blogentry.com> a écrit dans le message de
>> news:cv**********@ctb-nnrp2.saix.net...
>> > But you'd have to implement ISerializable on the controls...
>> >
>> > "Sushi" <su********@terra.com.br> wrote in message
>> > news:Oo**************@TK2MSFTNGP12.phx.gbl...
>> > > you can use the remoting solution.
>> > >
>> > > []'s
>> > > Sushi
>> > >
>> > >
>> >
>> >
>>
>>
>
>



Jul 21 '05 #11

P: n/a
thanks a lot, I'll see what I can do with it... The difference you made
between the two makes things clearer.

"Joshua Flanagan" <jo**@msnews.com> a écrit dans le message de
news:e7****************@TK2MSFTNGP14.phx.gbl...
Serialization and MarshalByRef are two different ways to access objects
from a different AppDomain (or "process").

Serialization is like passing an object ByVal - the contents is copied
from one process to the other, so that the object can be re-created in
the calling process.

MarshalByRef is like passing an object ByVal - a reference is copied
from one process to the other, and a proxy object is created in the
calling process. The client application has a reference to the proxy
object. Any calls to methods/properties on the "proxy" object in the
client get serialized and passed to the "real" object running in the
server process. The server object performs the work and then serializes
any return value to pass back to the proxy and the calling client code.

I think for the application you are trying to create, you would be
better off using MarshalByRef. However, you do not necessarily have to
make your existing objects/controls MarshalByRef. It might be a better
design to create monitoring objects designed specifically for this
purpose. They will inherit from MarshalByRef, and their methods will be
designed not to chatty. They expose a simple interface that doesn't
require a lot of serialization for the method parameters or return
values. The implementation of the methods handles all of the
communication with the real controls you are trying to monitor, running
in the service.

Take a little time to familiarize yourself with remoting before diving
into a solution. Do a google search for ".net remoting" and you should
find a number of good articles that explain the hows and whys. If you
have the time for a book, check out Rocky Lhotka's "Expert One-on-One
Visual Basic .NET Business Objects".

-Joshua Flanagan
ThunderMusic wrote:
Will this serialisation allow me to pass the control from my service to the application or will I need to create an instance of the control in my app and get the informations to display what I need to display from the service? I mean, to get a reference to the existing control from the service would be much more efficient, if it can be done.

I don't understand much about the serialisation in this case and/or
MarshalByRefObject. I don't know the differences and if one or the other can be used considering all the controls used will be made by me, so they can inherit from both (or can't they?)

"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
news:cv**********@ctb-nnrp2.saix.net...
You can't use MarhalByRef in your example. The root of the object
inheritance chain would have to be MarshalByRef, and Control is not.


That's
why you' have to implement ISerializable, in order to control the
serialization process.

Have a look at:
http://samples.gotdotnet.com/quickst...ializable.aspx
for an example

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl.. .

ok, after checking on MSDN, I found something about MarshalByReference


and
I
think it could be useful, but there are no example of how it can be used(well, I didn't find one). So I cannot say if this is the thing I need.
Does
someone know about an example?

thanks

"ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le messagede
news:ua**************@TK2MSFTNGP09.phx.gbl...

>ok, do you have an example of this? is it available on MSDN?
>
>Thanks a lot, it gives me a hint for where to begin... ;)
>
>"Sean Hederman" <us***@blogentry.com> a écrit dans le message de
>news:cv**********@ctb-nnrp2.saix.net...
>
>>But you'd have to implement ISerializable on the controls...
>>
>>"Sushi" <su********@terra.com.br> wrote in message
>>news:Oo**************@TK2MSFTNGP12.phx.gbl. ..
>>
>>>you can use the remoting solution.
>>>
>>>[]'s
>>>Sushi
>>>
>>>
>>
>>
>


Jul 21 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.