I want to launch an application minimized or not depending on it was launched by system on startup (Windows) or not minimized if it was launched by user (double clicked on it).
I've made a converter program so far which will open in windows start up. I've used this to success.
RegistryKey rk = Registry.CurrentUser.OpenSubKey
("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
rk.SetValue("MyApplicationName", Application.ExecutablePath);
rk.Close();
rk.Dispose();
I've only put these codes to startup. I don't check if it's already in regedit because its not adding if it's already there. After I've set these codes to my program I've restart my computer and my program came at startup but it come in center of my screen like normal startup. Can I check if my program is started by windows on startup and set it to startup? Normally my program hides itself to system tray if I click "x" on top right corner. I've to right click->exit to actually close my program.
My question is: Is there any way to check how was launched by the system (Windows) or by the user?