CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2004
    Posts
    7

    Question how to communicate between an application and a windows service..

    Hi all,

    How to communicate between an application and a windows service on the same machine.

    Here I want to access data generated by service and process it through an application(UI).

    Thanks..

  2. #2
    Join Date
    Oct 2004
    Location
    South Africa
    Posts
    86

    Re: how to communicate between an application and a windows service..

    hi
    i guess you can have a look at it from the log file of one exist.
    if its an application that you have the source code then you can let your project control it, ie
    use the lib and then start the process and even add some more code to get the debug information.
    if you dont have the code, then search for teh dll and lib file and try to start and stop the process and then call some functions and log some information .
    hope this helps, your question is a bit sketchy.

  3. #3
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: how to communicate between an application and a windows service..

    If it is your windows service, use remoting. Service will expose an object trought remoting and UI will consume it. If the service don't support remoting (e.g. it is not .NET) and you cannot adapt it, I afraid there is no way. If an author of the service don't provide such a facility.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  4. #4
    Join Date
    Dec 2004
    Posts
    7

    Cool Re: how to communicate between an application and a windows service..

    Hi all,
    To clear some confusion I want to tell that both the application and service are in C# and made by me.

    So, as Boudino has suggested I'll try using remoting. If any one else has any other solution or suggestion please post here.

    ps:Am I be able to exchange data in both way, from service to application and also from the application to the service.

    With thanks.

  5. #5
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: how to communicate between an application and a windows service..

    There are loads of ways of doing this : in fact I believe that there's an FAQ in the C++ forum on this very subject.

    Here's a few off the top of my head which might be simpler than using remoting :

    (1) Message Lists.
    (2) Named Pipes.
    (3) Polling of a file (i.e. get server to look at a file every so often to see if it's changed or use FileSystemWatcher). This is good for configuration changes.

    Lots more of course...

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured