Solved

Calling a Function

Posted on 2006-11-29
6
252 Views
Last Modified: 2013-11-20
Hi guys,

I have this function:

ExecuteScriptFunction(const CString strFunc,  const CStringArray& paramArray)


How would I call it?


String value, Array
String value, lots of string values


?


Cheers!
0
Comment
Question by:Cyber-Drugs
6 Comments
 
LVL 30

Accepted Solution

by:
Axter earned 250 total points
ID: 18038239
Hi Cyber-Drugs,
> How would I call it?

You need a CStringArray object to call this function.

Example:
CStringArray MyStrArray;
//Then populate above array

//Then call the function
ExecuteScriptFunction("foofoo", MyStrArray);



David Maisonave (Axter)
Cheers!
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18038312
Sorry Axter,

I suppose what I meant was...

How do I populate a CStringArray?


Cheers!
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 18038417
why not to use VARIABLE ARGUMENT FUNCTION with which you can pass unlimited no. (varaible) of arguments to function....just like printf().. as you know you may pass any no. of arguments to printf().. you may also have such type of function...

so that in function itself you may pass any no. strings  as parameters like :
ExecuteScriptFunction(const CString strFunc, strArg1,strArg2,strArg3......)

Look here for how to declare and define them :
http://www.codeproject.com/cpp/argfunctions.asp
http://www.codeguru.com/cpp/cpp/cpp_mfc/functions/article.php/c4025/

-MAHESH
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 22

Expert Comment

by:mahesh1402
ID: 18038461
more simple example related to variable argument is here :
http://www.codeproject.com/cpp/C___Variable_Arguments.asp

-MAHESH
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18038488
Hi Mahesh,

Thank you for all the detailed links, and I will be reading them to learn a few new tricks, but for this question I'm basically looking for something I can cut and paste into C++ to test if the function works properly...

As you helped write the function, maybe you could show me how to use it?

Cheers!
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 250 total points
ID: 18039223
CStringArray ar;

ar.Add("string1");
ar.Add("string2");
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Title # Comments Views Activity
Expand macro to ask for filename column 8 37
canBalance challenge 34 96
fix34  challenge 9 140
matchUp  challenge 9 115
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

839 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