command line arguments?

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

command line arguments?

Post by Anthony11 »

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: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: command line arguments?

Post by doublemax »

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?

Post by Anthony11 »

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: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: command line arguments?

Post by doublemax »

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?

Post by Anthony11 »

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
Post Reply