Results 1 to 6 of 6

Thread: [RESOLVED] Custom service questions

  1. #1

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    Resolved [RESOLVED] Custom service questions

    Just wondering if I can in vb.net have a service that also runs as a windows forms application as the same .exe file, and if so how I can do this.

    I used to do this in vb6 - basically if you ran my vb6 exe and the service was not installed it would ask you to install the service (which was the same exe file it wouldn't extract anything).
    It would then run as a service and if the exe was opened after the service was installed it would open up an interface that interacts with the service.

    Also if it is possible to do something like this in .net I assume that i could somehow show an interface directly from the service rather than creating another process that interacts with the running service?

    Thanks in advance
    Kris

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Custom service questions

    So you are telling that you had an exe that was a program and a service installer?
    Then i must get back to vb6
    Anyhow for your first question, i don't know if you can auto-turn an exe app to a service.If you show a little code on how you did this on vb6 maybe we can try to reverse it for .net.Personally i haven't done something like this, but the usual .net way is create the service-install the service-run,activate the service.
    Also on your interface question.It is possible but mind you the service run on another thread and not the desktop one, so you need some modification through threading and also some registry change (if you want it to be done automatically) to specify that this service can interact with the desktop.I usually do that on the service installation but maybe there is another way.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    Re: Custom service questions

    yes i did and the code was all in the one project ... no references ... i can provide the vb6 code if u want...

    i semi - tried to convert it to .net with not alot of luck

    Kris

  4. #4

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    Re: Custom service questions

    i used the code from http://smsoft.ru/en/ntservice.htm for the vb 6 service

    Kris

  5. #5
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Custom service questions

    Seems the code is gone on the page.
    But anyhow i suggest you start creating your service and post for any problems.
    If you want to have a service to also run as a winforms application the i can't think of another way than making the service interact with the desktop.But from what i've read you had the app interact with the service.And i suggest you better leave it that way cuz the other way around is very complicated.
    But i don't know. is this the real usage of a service?Anyhow for ease you can create the service and the app separately.If not then yes post some code in case we can make something out.
    Now i have to sleep.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  6. #6

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    Re: Custom service questions

    dw worked out how 2 do it using all managed code

    Kris

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