Solved

Passing Command Line Args

Posted on 1997-03-05
1
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 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.

751 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