Solved

Passing Command Line Args

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

860 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