none
How to use System.Management to pass data between a Windows Service and Winform RRS feed

  • Question

  • I know the ServiceController.ExecuteCommand allows you to pass an integer to a service but it doesn't allow you to pass complex types.  I found a response to a similar question on bytes.com that said the following:

    Another option is to expose object instances through System.Management and
    WMI in your service, the client application(s) can query these instances. To
    pass commands to the service you could install a Management event handler
    and let the client fire events passing objects as command arguments.
    The advantage over remoting is that it uses DCOM as wire level protocol with
    it's built-in security.

     

    This was a pretty old topic post (circa 2005) Can anyone here elaborate on whether this is still a good approach and maybe provide a short example, thanks!

     

    Tuesday, March 1, 2011 8:59 PM

Answers

  •  

    Does your requirement restricts us to use WMI? actually, any IPC/RPC technology can do this job, such as File Mapping, Mailslot, NamedPipe, Remoting, Socket or use WM_COPYDATA, the All-In-One IPC and RPC Samples solution demonstrates  all of above technologies in C++/C#/VB.NET, you may want to have a look.


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by eryang Tuesday, March 15, 2011 2:43 AM
    Wednesday, March 2, 2011 9:55 AM

All replies