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

    Referencing a Windows Forms App from a Windows Service App

    Using VS2010 .NET 4.0

    Is there a way to basically merge a Windows Forms Application with a Windows Service Application and allow the passing of parameters on start up to determine if it should start the standard GUI or launch as a system service.

    Is that even possible or reasonable?

    I'd like to not have to manager two projects xD (would that be the only alternative?)

    Thanks,
    Zok

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Referencing a Windows Forms App from a Windows Service App

    A Service BY DEFAULT can have no USER INPUT, so NO. Of course, you could probably figure out a way to pass parameters to modules, but, I wouldn't bother
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Referencing a Windows Forms App from a Windows Service App

    I think you need two projects in one solution one to compile as an exe the other as a service. Both could share one or more of the classes but the programs would be independant of each other.
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Aug 2011
    Posts
    2

    Re: Referencing a Windows Forms App from a Windows Service App

    Thanks to you both. I'ma try DataMiser's solution and see how it goes =)

  5. #5
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Referencing a Windows Forms App from a Windows Service App

    I agree with two different projects as much better and easier than a single.

    Although, in Vista/7 it is easy to add a program so that it starts up at the boot screen, provided the user adding it is an admin. In that case a single windows form app will do.

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