Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6578909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:49:54+00:00 2026-05-25T15:49:54+00:00

In an MFC program, you can determine whether the application shortcut had the Run

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:49:54+00:00Added an answer on May 25, 2026 at 3:49 pm

    In WindowsForms its the WindowState property of Form class. check it up in properties at design time or set it from code.

    Edit: When running the program from a shortcut Windows is likely to use the CreateProcess API passing a STARTUPINFO structure to it.

    from your Windows Forms application you get such structure in this way:

    System.Diagnostics.Process.GetCurrentProcess().StartInfo
    

    which contains the property: WindowStyle and the available values for it are those of the enum:

    System.Diagnostics.ProcessWindowStyle
    

    so:

    Hidden;
    Minimized;
    Maximized;
    Normal;
    

    and that’s the mapping to m_nCmdShow the OP is looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used Visual Studio's Application Wizard to create a skeleton MFC program with a
I am trying to make a C++/MFC application (so called Update Application) that can
In my MFC program I am using a splitter to create two panes. I
How do I get an old VC++ 6.0 MFC program to read and display
Greetings! I am trying to check directory write-permissions from within a Windows MFC/ATL program
(MFC Question) What's the best way to determine the current displayed client area in
In MFC I'm trying to set a null handler timer (ie. no windows). But
The MFC application that i created is dialog based. Just one dialog thats all.
In MFC, a CListBox has a disable no scroll property. When you set it
c++ mfc if CHttpConnection::OpenRequest returns a null what can I use to get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.