Command line parsing

Vadim Zeitlin vadim at wxwindows.org
Sun Mar 11 05:00:29 PDT 2007


On Sat, 10 Mar 2007 23:48:58 -0600 Kenneth Porter <shiva.blacklist at sewingwitch.com> wrote:

KP> For now my initial app needs a parameter to indicate which of several 
KP> sections in a configuration file should be used, eg. invocation would be 
KP> "myapp config1" or "myapp config2", with a default config assumed if no 
KP> parameter is passed.

 If YourApp::OnInit() calls wxApp::OnInit() parsing is done inside wxApp
itself and uses OnInitCmdLine() and OnCmdLine{Help/Parsed/Error}() virtual
methods to allow you to customize it.

 So:

1. Set up wxCmdLineParser to accept the parameters/options you support in
   YourApp::OnInitCmdLine()

2. Also override at least YourApp::OnCmdLineParsed() to get the parsing
   results.

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/





More information about the wx-users mailing list