0

I have a MFC GUI application. Now I have to execute this exe from commmand prompt with parameter.I need to know where I have to change the code in order that it use parameter from cmd.

When I debug the code the control comes here:

CConnectDlg::CConnectDlg(CWnd* pParent /*=NULL*/)
: CDialog(CConnectDlg::IDD, pParent)
{
    //{{AFX_DATA_INIT(CConnectDlg)
    m_ul_Timeout = DEFAULT_TIMEOUT;
}

So I think I have to change here. Please suggest.

jiten
  • 5,128
  • 4
  • 44
  • 73
  • 2
    Possible duplicate of [How to get the command line arguments in mfc applications?](https://stackoverflow.com/questions/5562877/how-to-get-the-command-line-arguments-in-mfc-applications) – acraig5075 Jun 17 '18 at 07:16

1 Answers1

2

You can get the command line anywhere in your application, calling GetCommandLine. To split the command line into individual arguments, you can call CommandLineToArgvW.

Alternatively, you can use the global __argc, __argv, __wargv symbols, that provide the same information, and are available anywhere in your program as well.

IInspectable
  • 46,945
  • 8
  • 85
  • 181
  • Yes, I had find it on google.btw thanx. now I have to send data to command prompt. Any idea. – jiten Jun 17 '18 at 07:19
  • 2
    @vikky: If you have a new question, click the [Ask Question](https://stackoverflow.com/questions/ask) button, after you have done enough research to assess, that this question hasn't been asked before. – IInspectable Jun 17 '18 at 09:14