12

I know that you can create a Windows Forms application and set it to be invisible. And if I create a console application (the console window will open- and I have no use for the console), how do I create a simple application that has no GUI at all?

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Amir.F
  • 1,841
  • 7
  • 26
  • 50
  • You can hide the console window as well with an API call. Where are you runnng this from, another aplication, the desktop. Is it a service, or just a one off do something and quit? – Tony Hopkinson May 12 '12 at 12:03
  • 3
    Write a console mode app and just change the Output type setting to "Windows application" – Hans Passant May 13 '12 at 07:30

2 Answers2

24

Create a windows application, remove the Form1.cs file, edit the Program.cs file to remove the lines

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());

Put your own code instead, and you're done.

Omar
  • 15,543
  • 9
  • 43
  • 64
Kevin Gosse
  • 37,617
  • 3
  • 74
  • 89
3

You could create it as a windows service.

This question also has some options for running an existing console application with no console window, so you could write a console application, then write a console application which launches that with its window hidden and then closes.

Community
  • 1
  • 1
Sam Holder
  • 31,788
  • 13
  • 99
  • 173