command line arguments?

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Anthony11
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Jul 05, 2015 7:14 am

command line arguments?

Postby Anthony11 » Sat Jul 11, 2015 10:04 am

i'm using wxSmith (Code::Blocks) for development. I want to get the command line arguments on beggining of my program, but I can't find main function anywhere, ony OnInit which is located in the ....App.cpp.

User avatar
doublemax
Moderator
Moderator
Posts: 11290
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: command line arguments?

Postby doublemax » Sat Jul 11, 2015 10:18 am

Use the source, Luke!

Anthony11
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Jul 05, 2015 7:14 am

Re: command line arguments?

Postby Anthony11 » Sat Jul 11, 2015 10:34 am

Code: Select all

wxApp xarg;
        if (xarg.argc == 2) {
            if (xarg.argv.GetArguments().Item(1) == "fopen") {
                dlgIntro.ntbMain->SetSelection(1);
            }
        }


program.exe "fopen"

Nothing happens

User avatar
doublemax
Moderator
Moderator
Posts: 11290
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: command line arguments?

Postby doublemax » Sat Jul 11, 2015 10:39 am

You can't just create a new wxApp instance. Remember that the starting point of your wxWidgets application is OnInit() from your wxApp derived class? That's where you can access the argc/argv members.
Use the source, Luke!

Anthony11
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Jul 05, 2015 7:14 am

Re: command line arguments?

Postby Anthony11 » Sat Jul 11, 2015 10:42 am

thanks, i realised that just after. i was trying to make it to get WXAPP.argc, but then i saw that the function is actually in a class function WXAPP::OnInit, so i replaced WXAPP.argc with argc


Return to “wxDev-C++”

Who is online

Users browsing this forum: No registered users and 2 guests