My Windows Forms application starts another one; the latter is meant to remain hidden, and appear and disappear as the user presses the F9 key.
I need the hidden form to run in another process, so I use Process.Start. However, no matter what I do, I can’t get the form to start hidden. It always appears in the bottom left corner, and weirdly, it only shows the title bar, from which I can maximize it. This is undesired.
I tried tweaking the StartInfo with ShellExecute = false, CreateNoWindow = true, WindowStyle = ProcessWindowStyleHidden, you name it.
I also tried going to the form’s designer and setting ShowInTaskbar to false, but no cigar. One thing that drew my attention when I tried that is that the WindowState property could only be set to Normal, Minimized or Maximized, not Hidden.
I’m stumped. Any suggestions? (Asides from ditching Windows Forms; this is legacy code)
Edit: (Very important) I forgot to mention that my main app is full screen, and that the windows desktop is locked. That is, when the machine boots up, my main app is started instead of Explorer
I solved this a long time ago, but forgot to post my solution. The key was to have the form’s created minimized. In the designer, in
InitializeComponent, I added:And, for good measure, I did it once again after calling
InitializeComponent(there is an almost imperceptible flicker but it works):