How do I run a windows application from a Service?

Posted on 2009-04-17
Last Modified: 2012-06-21
I am totally new to Windows Services and I need to write one in that simply calls a Windows application. The Windows App is a small program that runs continuously, monitoring messages and running timed reports. It has a user interface for the administrator to just show the event log and so you can see when the next timed event will be.

I need this app to always be running on the server even when the administrator has logged off and it needs to always start again if the server has been restarted for any reason, hence I thought a service that calls it would be the best way to do it.

I have created a Windows Service project, added a service installer, set the starttype to automatic but I am not sure where or how to "shell" to my app (Process.start I think?)

Any help would be much appreciated!
Question by:alexking
    LVL 48

    Accepted Solution


    Author Comment

    I'm following this through, have created something simple that just uses:


    as the samples seemed to dive into C++ which I am not using and am not familiar with, but am now struggling to install it using the link to - i have created an installer but when I install on the target server I am asked to "set service login", username and password dialogue box. I enter my login and password (I am logged in as administrator)  but it says "The account name is invalid or does not exist or the password is invalid for the account name specified" - it isn't, it is my main administrator account that I am logged in as!!

    Author Comment

    Just found changing ProcessInstaller account to LocalSystem gets rid of this dialogue so trying again :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    This is an explanation of a simple data model to help parse a JSON feed
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now