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,738
  • 21
  • 105
  • 131
Amir.F
  • 1,911
  • 7
  • 29
  • 52
  • 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

25

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
  • 16,329
  • 10
  • 48
  • 66
Kevin Gosse
  • 38,392
  • 3
  • 78
  • 94
4

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
  • 32,535
  • 13
  • 101
  • 181