Page 1 of 1

Problems to get commandline parameters

Posted: Sun Apr 29, 2007 8:42 pm
by Onyx

i'm new into wxWidgets coding and i have a problem concerning reading my command line parameters.
I just created an Application by using the Wizard, its a Dialog based project.

This is a code snippet from my main Dialog:

Code: Select all

#include "wxMicroshieldApp.h"
#include "wxMicroshieldDlg.h"


bool wxMicroshieldDlgApp::OnInit()
	wxMicroshieldDlg* dialog = new wxMicroshieldDlg(NULL);
	return true;

int wxMicroshieldDlgApp::OnExit()
	return 0;
As you can see there did not happen much. As im more into standard win32 coding i was used to get cml parameter by accessing argc and argv in the past. But this seems not to work for a wxWidgets application right ?

Can someone give me i hint how to access these two variables if they are still present in wxWidgets coding and if not what my alternatives are.

Thank you in advance,

Posted: Sun Apr 29, 2007 8:59 pm
by Onyx
:oops: me once again...

i solved the problem by my self. I found out that the commandline arguments can be simply accessed by like that:

Code: Select all

if(argc > 1) {
        //MessageBox(NULL, NULL, NULL, NULL);
    } else {
The problem was that i didn't see that declaration of argc and argv in any file inside my project. Seems that they are defined somewhere...


Posted: Sun Apr 29, 2007 11:49 pm
by lowjoel
It's defined in the wxApp class.


Posted: Mon Apr 30, 2007 5:09 am
by Onyx
Thank you for your info.