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 call a "Windows Form Application" in a "Windows Service"?

How to call a "Windows Form Application" in a "Windows Service"?

Scheduled Pinned Locked Moved C#
helptutorialquestion
7 Posts 4 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.
  • D Offline
    D Offline
    DaKhucBuon
    wrote on last edited by
    #1

    Hi everybody, + I's 02 application: - application A : a windows service - application B : a windows form program (a .exe file) and my problem's: when call app B within A's code then B unable get window title of windows although it's working when run B alone. anybody resolve it?

    P D L D 4 Replies Last reply
    0
    • D DaKhucBuon

      Hi everybody, + I's 02 application: - application A : a windows service - application B : a windows form program (a .exe file) and my problem's: when call app B within A's code then B unable get window title of windows although it's working when run B alone. anybody resolve it?

      P Online
      P Online
      PIEBALDconsult
      wrote on last edited by
      #2

      Please don't do that. What are you really trying to accomplish?

      1 Reply Last reply
      0
      • D DaKhucBuon

        Hi everybody, + I's 02 application: - application A : a windows service - application B : a windows form program (a .exe file) and my problem's: when call app B within A's code then B unable get window title of windows although it's working when run B alone. anybody resolve it?

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        You can't do that. There is no way to resolve it because a Windows Service runs under a completely seperate Desktop from the users desktop. UI applications do not ever get to show any windows so there is no window for your service code to find!

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        1 Reply Last reply
        0
        • D DaKhucBuon

          Hi everybody, + I's 02 application: - application A : a windows service - application B : a windows form program (a .exe file) and my problem's: when call app B within A's code then B unable get window title of windows although it's working when run B alone. anybody resolve it?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          The question is what OS are you using? If you are using XP then you can allow the service to access the UI. If you are using Vista or later you will need to create middle-ware executable that the Service can access and the middle-ware then can touch and control the separate UI executable. There are numerous reasons why this is, but simple put a service should not touch the UI. A service runs independent of the active user and there can be multiple users. With that the service would not know which user's UI to touch. This creates security holes as well as functionality issues. Simply put, you should not do this.

          Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

          D 1 Reply Last reply
          0
          • L Lost User

            The question is what OS are you using? If you are using XP then you can allow the service to access the UI. If you are using Vista or later you will need to create middle-ware executable that the Service can access and the middle-ware then can touch and control the separate UI executable. There are numerous reasons why this is, but simple put a service should not touch the UI. A service runs independent of the active user and there can be multiple users. With that the service would not know which user's UI to touch. This creates security holes as well as functionality issues. Simply put, you should not do this.

            Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

            D Offline
            D Offline
            DaKhucBuon
            wrote on last edited by
            #5

            thank everybody... I'm sad...:confused::confused::confused: anybody's other solution? :^) :^) :^) :^)

            P 1 Reply Last reply
            0
            • D DaKhucBuon

              thank everybody... I'm sad...:confused::confused::confused: anybody's other solution? :^) :^) :^) :^)

              P Online
              P Online
              PIEBALDconsult
              wrote on last edited by
              #6

              Think about the features you need, not how to implement it.

              1 Reply Last reply
              0
              • D DaKhucBuon

                Hi everybody, + I's 02 application: - application A : a windows service - application B : a windows form program (a .exe file) and my problem's: when call app B within A's code then B unable get window title of windows although it's working when run B alone. anybody resolve it?

                D Offline
                D Offline
                DaKhucBuon
                wrote on last edited by
                #7

                I found other solution: I created a Task Scheduler for app B (B recreate task in 10'). when app A can't find process of B it's call Task to run B. all done. thank everybody. :-O

                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