The thing is, I really don't want the console window to show up, but the solution should be running. My point here is, I want to keep the application running in the background, without any window coming up.
How can I do that?
The thing is, I really don't want the console window to show up, but the solution should be running. My point here is, I want to keep the application running in the background, without any window coming up.
How can I do that?
Instead of Console.Readline/key you can use new ManualResetEvent(false).WaitOne() at last. This works well for me.
You can use user32.dll to achieve this without vscode
class start
{
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
static void Main()
{
IntPtr h = Process.GetCurrentProcess().MainWindowHandle;
ShowWindow(h, 0);
// Do the rest
This still flashes the screen but works good enough
the usings are
using System.Runtime.InteropServices;
using System.Diagnostics;
Note im still new to csharp and not perfect so feel free to comment and corrections!
Change the output type from Console Application to Windows Application,
And Instead of Console.Readline/key you can use new ManualResetEvent(false).WaitOne() at the end to keep the app running.