Problems to get commandline parameters

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
Onyx
In need of some credit
In need of some credit
Posts: 3
Joined: Thu Apr 05, 2007 12:18 am
Location: Augsburg, Germany
Contact:

Problems to get commandline parameters

Post by Onyx » Sun Apr 29, 2007 8:42 pm

Hi,

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"

IMPLEMENT_APP(wxMicroshieldDlgApp)

bool wxMicroshieldDlgApp::OnInit()
{
	wxMicroshieldDlg* dialog = new wxMicroshieldDlg(NULL);
	SetTopWindow(dialog);
	dialog->Show(true);
	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,
0110011010100110101010110101110100101

http://www.microshield.de

Onyx
In need of some credit
In need of some credit
Posts: 3
Joined: Thu Apr 05, 2007 12:18 am
Location: Augsburg, Germany
Contact:

Post by Onyx » Sun Apr 29, 2007 8:59 pm

: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 {
        dialog->Show(true);
    }
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...

Regards,
0110011010100110101010110101110100101

http://www.microshield.de

lowjoel
Moderator
Moderator
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel » Sun Apr 29, 2007 11:49 pm

It's defined in the wxApp class.

Joel

Onyx
In need of some credit
In need of some credit
Posts: 3
Joined: Thu Apr 05, 2007 12:18 am
Location: Augsburg, Germany
Contact:

Post by Onyx » Mon Apr 30, 2007 5:09 am

Thank you for your info.
0110011010100110101010110101110100101

http://www.microshield.de

Post Reply