Solved

Passing Command Line Args

Posted on 1997-03-05
1
214 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

867 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

16 Experts available now in Live!

Get 1:1 Help Now