Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a C# program without a GUI?

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?

like image 596
Amir.F Avatar asked May 12 '12 11:05

Amir.F


People also ask

How can I write C in Windows?

Two options. Great, now that Visual Studio Community is installed, you have two options for developing and running C programs on Windows. The first option involves using any text editor you like to write your source code, and using the "cl" command within the Developer Command Prompt to compile your code.

How do I get C in Visual Studio?

1. We need to click on the extension button that displays a sidebar for downloading and installing the C/C++ extension in the visual studio code. In the sidebar, type C Extension. In this image, click on the Install button to install the C/C++ extension.


2 Answers

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.

like image 168
Kevin Gosse Avatar answered Oct 11 '22 10:10

Kevin Gosse


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.

like image 42
Sam Holder Avatar answered Oct 11 '22 09:10

Sam Holder