Solved

Passing Command Line Args

Posted on 1997-03-05
1
213 Views
Last Modified: 2010-04-10
Hello,
I have been trying to pass comand line arguments to my Owl program. What do I need to do to pass several comand line arguments back to my TDialog and process them? Does someone have any example code to do this?
Thanks for your help.

Regards, Gerry
0
Comment
Question by:gcapwell
1 Comment
 
LVL 3

Accepted Solution

by:
gaohong earned 50 total points
ID: 1162273

Hi,

Your command line arguments are in globals, so include two lines
in your dialog source file

extern int   _argc;
extern char  **_argv;


//here is my own processing in MDI Client window

bool mxMDIClient::PreProcessMsg(MSG& msg)
     {
     static int first = 1;

     //process command line
     for(int i = 1; first && i < _argc && _argv[i] && *_argv[i]; i++)
         {
         OpenFile(_argv[i]);
         }
     first = 0;
 
     return TMDIClient::PreProcessMsg(msg);
     }


Hope this helpful

Gaohong Xie


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now