[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Passing Command Line Args

Posted on 1997-03-05
1
Medium Priority
?
234 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 100 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 to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

831 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