Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Update Windows Service member variable from external windows Application in c# [modified]

Update Windows Service member variable from external windows Application in c# [modified]

Scheduled Pinned Locked Moved C#
csharptutorialannouncement
6 Posts 3 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    platso_588
    wrote on last edited by
    #1

    Hello, Can any one tell me how to update the member variable of my windows service from another windows Application. I just need to update a flag variable from external windows application. I want to implement this in c#. The Windows service is already made. Just need to set the flag. This flag is needed to control the launch of another windows application from this running windows service.

    modified on Monday, November 16, 2009 3:52 AM

    C D 2 Replies Last reply
    0
    • P platso_588

      Hello, Can any one tell me how to update the member variable of my windows service from another windows Application. I just need to update a flag variable from external windows application. I want to implement this in c#. The Windows service is already made. Just need to set the flag. This flag is needed to control the launch of another windows application from this running windows service.

      modified on Monday, November 16, 2009 3:52 AM

      C Offline
      C Offline
      Covean
      wrote on last edited by
      #2

      There are some ways. You can use self-defined service commands, a small TCP/IP connection, named pipes or maybe names events / shared memory. For the last of these possibilities have a look at this posts. Hope that helps.

      Greetings Covean

      P 1 Reply Last reply
      0
      • P platso_588

        Hello, Can any one tell me how to update the member variable of my windows service from another windows Application. I just need to update a flag variable from external windows application. I want to implement this in c#. The Windows service is already made. Just need to set the flag. This flag is needed to control the launch of another windows application from this running windows service.

        modified on Monday, November 16, 2009 3:52 AM

        D Offline
        D Offline
        dojohansen
        wrote on last edited by
        #3

        Probably not what you're looking for but perhaps you could simply use some external resource that both applications may access? If the service uses a FileSystemWatcher it can receive an event when a file changes, and if it only opens the file for reading there should be no problems with the file being in use or anything like that. So the app needing to inform the service of something would simply update a file, or place a new file in a directory, or put the information in a database. Or why not use a message queue? This would also let you queue messages regardless of whether or not the service is up and running of the time of creating the message. I'm sure there are many other possibilities, but generally speaking it seems like an odd way of interfacing between applications to have one application directly modify the state of another - you could hardly get further away from the good OOP practice of encapsulation.

        1 Reply Last reply
        0
        • C Covean

          There are some ways. You can use self-defined service commands, a small TCP/IP connection, named pipes or maybe names events / shared memory. For the last of these possibilities have a look at this posts. Hope that helps.

          Greetings Covean

          P Offline
          P Offline
          platso_588
          wrote on last edited by
          #4

          Thank you for your response. If we develop a windows service in VC++ we can add an "Interface" and can add "Method" to it. This method can be exported to outside applications. This Method can be used by external applications by calling CoCreateInstance() and can get the pointer to the interface and this pointer can call the function. I just like to have similar Implementation but both the Windows Service and Windows Application need to be implemented in c#. Prasad

          C 1 Reply Last reply
          0
          • P platso_588

            Thank you for your response. If we develop a windows service in VC++ we can add an "Interface" and can add "Method" to it. This method can be exported to outside applications. This Method can be used by external applications by calling CoCreateInstance() and can get the pointer to the interface and this pointer can call the function. I just like to have similar Implementation but both the Windows Service and Windows Application need to be implemented in c#. Prasad

            C Offline
            C Offline
            Covean
            wrote on last edited by
            #5

            The easiest way is to control your service with user-defined service control commands. See ServiceBase.OnCustomCommand and ServiceController.ExecuteCommand.

            Greetings Covean

            P 1 Reply Last reply
            0
            • C Covean

              The easiest way is to control your service with user-defined service control commands. See ServiceBase.OnCustomCommand and ServiceController.ExecuteCommand.

              Greetings Covean

              P Offline
              P Offline
              platso_588
              wrote on last edited by
              #6

              Thankyou Covean, With this approach i implemented and is working. The Link http://www.codeproject.com/KB/dotnet/WindowsServices.aspx is helpful. Thanks, Prasad

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups