-3

I want to create program that run all the time (not a Windows Service exactly). I want it to have no view to the user.

I would like it to be a process, the reason I don't want it to be service is because I want to create to process and I want one service to start them.

I don't know how to create the program without any UI as if I create console application the CMD open when I run the program.

halfer
  • 19,824
  • 17
  • 99
  • 186
MoShe
  • 6,197
  • 17
  • 51
  • 77
  • 3
    `Process.Start("processname");` ? – Ben Robinson Jan 26 '12 at 17:22
  • @MoShe - -1. Please check my edits and provide what have you tried and what you actually want to achieve (as Ben said `Process.Start` is what you may be looking for, also simple search on http://www.bing.com is you are banned on Google should be enough to find it). – Alexei Levenkov Jan 26 '12 at 17:40
  • questions like this are a direct result of attempting to code, right of the Ballmer Peak - http://xkcd.com/323/ – Eoin Campbell Jan 26 '12 at 17:54
  • See http://stackoverflow.com/questions/836427/how-to-run-a-c-sharp-console-application-with-the-console-hidden – Phil Bolduc Jan 26 '12 at 18:23
  • I know what your problem is and @BenRobinson who posted that first comment doesn't understand what you are asking... Did you fix the problem? If not, I have the solution for you. – S.H. Nov 09 '13 at 19:28

1 Answers1

-1

I'm taking a guess as to what you're trying to do, but here's a really simple console application that runs until you hit the ENTER key. It will print out a line to the console every second.

class Program
{
    static void Main(string[] args)
    {
        using (System.Threading.Timer processTimer = new System.Threading.Timer(DoSomething, "fun", 0, 1000))
        {
            Console.ReadLine();
        }
    }

    static void DoSomething(object data)
    {
        Console.WriteLine("doing something {0}...", data.ToString());
    }

}

You can replace the contents of DoSomething with what you need your console runner to do.

I hope this helps.

David Hoerster
  • 28,421
  • 8
  • 67
  • 102
  • Haha i didnt downvote... But what you said made me laugh so +1 for that. Jus so you know your answer is not correct because he is trying to call a process at startup from a service. Which is not as simple as process.start or your solution. But to be fair you said you said giving an educated guess so its okay. But i didnt down vote. But gave you an upvote for your comment made me laugh hehe. – S.H. Nov 09 '13 at 20:15