I have a Dialog based MFC Application. I want to retrieve the command line arguments on the InitInstance() function of my App Class. How do I do this if the function has no parameters? Thanks in advance.
Just before the line
int nResponse = dlg.DoModal();
To test it, modify the settings 'Program Arguments' in the 'Debug Tab' to something like this;
-Modeemo -Line:1234 -File:c:\demo
If you run the program, you should have the following lines in the 'Debug' tag of the Output window
Parameter ::Modeemo:: Last One ? FALSE
Parameter ::Line:1234:: Last One ? FALSE
Parameter ::File:c:\demo:: Last One ? TRUE
Of course, now you'll have to dig a few in the doc. and handle the possible erroneous parameters entered by the user. At least, you already got them.
Note that -Mode:, -Line:, .. are not required.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.