In an MFC program, you can determine whether the application shortcut had the Run value set to "Minimized" by checking the value of m_nCmdShow
. Is there an equivalent way to do this in c#?
To clarify, I don't want to set the state of a particular form. If you look at the properties for a shortcut, there is a "Run" option. You can set this value to Normal Window, Minimized, or Maximized.
In C++ you can read what that startup value was set to by looking at m_nCmdShow
. I need to do the same thing in C#.
Update
This attempt:
[STAThread]
static void Main(string[] args)
{
ProcessStartInfo processInfo = Process.GetCurrentProcess().StartInfo;
MessageBox.Show(processInfo.WindowStyle.ToString());
...
}
always reports Normal
, no matter what the shortcut is set to.