Project - Windows Forms (application)
Tell me how to properly hide the application if on the cmd command line write a command:
C:\app.exe /h Necessary in order to manage the application through a local network or through the Windows Scheduler using the application shortcut.
In addition, the following code in the application:
public partial class Form1 : Form { private void Form1_VisibleChanged(object sender, EventArgs e) { string[] passedInArgs = Environment.GetCommandLineArgs(); foreach (string s in passedInArgs) { if (s.ToUpperInvariant() == "/H") { this.Hide(); RegistryKey key = Registry.LocalMachine.CreateSubKey("SOFTWARE\\TEST002"); key.SetValue("000", "111"); key.Close(); this.Close(); } else { Registry.LocalMachine.DeleteSubKey("SOFTWARE\\TEST002", false); } } } public Form1() { InitializeComponent(); } }