Made a simple console application. In the properties of the project, I changed the type of the application to the Windows application - this way the application is opened hidden.
However, when you start the application, the mouse cursor in Windows changes to busy :
There is nothing special about the Main method. In the DoWork method, methods for cleaning unnecessary files work.
static void Main() { var processes = Process.GetProcessesByName("mpCleaner"); if (processes.Length > 1) Environment.Exit(0); DoWork(); } private static void DoWork() { try { Thread.Sleep(5000); RemoveOldFunctions(); RemoveUnsupportedAutocadFunctions(); RemoveDllsFromTopDirectory(); RemovePendingOverwriteFiles(); RemoveOldDlls(); RemoveAutocadFunctionsIfHasItInSubdirectory(); } catch { // } finally { Environment.Exit(0); } } Is it possible to remove the cursor change? There is no need to offer a service

PeekMessageandGetMessagethat the Windows could see that the process "hears" it, otherwise it thinks that it hung (this is the main core of ProcessMessages). UDP Oh, yes on c # this is most likely at stackoverflow.com/questions/34613362/… - nick_n_a