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. How to use window applications in window services

How to use window applications in window services

Scheduled Pinned Locked Moved C#
helptutorial
6 Posts 5 Posters 0 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.
  • B Offline
    B Offline
    Bojja Lakshmi
    wrote on last edited by
    #1

    Hi iam new to window services. I developed a window application which is an desktop alret. I need to run this application with a window service. Is there any way to use window applications in window services. Help me out from this. Lakshmi.

    A P S 3 Replies Last reply
    0
    • B Bojja Lakshmi

      Hi iam new to window services. I developed a window application which is an desktop alret. I need to run this application with a window service. Is there any way to use window applications in window services. Help me out from this. Lakshmi.

      A Offline
      A Offline
      Andrei Ungureanu
      wrote on last edited by
      #2

      Never tried it, but you can try building you windows application as a class library (dll file) from Project Properties->Application->Output type->Class Library. After that you can add to you windows service as reference, and open the form(s) whenever you want. This way your windows application doesn't have to be at specific path. Hope it helps.

      Do your best to be the best

      B 1 Reply Last reply
      0
      • A Andrei Ungureanu

        Never tried it, but you can try building you windows application as a class library (dll file) from Project Properties->Application->Output type->Class Library. After that you can add to you windows service as reference, and open the form(s) whenever you want. This way your windows application doesn't have to be at specific path. Hope it helps.

        Do your best to be the best

        B Offline
        B Offline
        Bojja Lakshmi
        wrote on last edited by
        #3

        Hi I tried the way you said, but iam not getting the result. Is there any other way? Please do inform me. Lakshmi

        R 1 Reply Last reply
        0
        • B Bojja Lakshmi

          Hi I tried the way you said, but iam not getting the result. Is there any other way? Please do inform me. Lakshmi

          R Offline
          R Offline
          RaviBattula
          wrote on last edited by
          #4

          Hi, There are several ways try this. 1. First create windows service application(minimal application) 2. private static Form Form1; protected override void OnStart(string[] args) { //Here call your windows application using process call or using seperate class object. Form1=new Form(); base.OnStart(args); }

          Ravi

          1 Reply Last reply
          0
          • B Bojja Lakshmi

            Hi iam new to window services. I developed a window application which is an desktop alret. I need to run this application with a window service. Is there any way to use window applications in window services. Help me out from this. Lakshmi.

            P Offline
            P Offline
            PaulPrice
            wrote on last edited by
            #5

            I would suggest that the best way would be to refactor the application logic away from the form (into a dll) and refactor the form to use this. Then you can create a service project to call the relevant app code.

            Paul

            1 Reply Last reply
            0
            • B Bojja Lakshmi

              Hi iam new to window services. I developed a window application which is an desktop alret. I need to run this application with a window service. Is there any way to use window applications in window services. Help me out from this. Lakshmi.

              S Offline
              S Offline
              Scott Dorman
              wrote on last edited by
              #6

              You really shouldn't do this. What you are looking for is a service that has the "Interact with desktop" option selected. This is not recommended practice. Services are intended to be run at the system level, even when someone is not logged in so they aren't supposed to have any UI. To do what you want, you need to create a Windows service and a Windows client application (2 different executables). The client application can run at Windows startup (when a user logs in). When the service needs to display an alert, it needs to inform the client application that there is something to display to the user. There are a lot of different ways to do this, from shared memory to remoting/wcf calls.

              Scott.


              —In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]

              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