|
Anthony Appleyard wrote: 1>c:\2d\ppp_vc\ppp_vc\ppp.cpp(274) : error C2664: 'vsprintf' : cannot convert parameter 3 from 'char **' to 'va_list'
So have you looked at the prototype for vsprintf() to see what it is expecting as arguments? The error messages seems fairly self-explanatory.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to get the choosed menu's caputer,then to modifly StatusBar's info.
At Event: OnMenuSelect(UINT nItemID,UINT nFlags,HMENU hSysMenu)
I write
void CMainFrame::OnMenuSelect(UINT nItemID,UINT nFlags,HMENU hSysMenu)
{
CString str;
CMenu* pMainMenu = GetMenu();
CMenu* pSubMenu = pMainMenu-> GetSubMenu(nItemID);
pSubMenu->GetMenuString(nItemID,str,MF_BYCOMMAND);
}
But when compile to the " pSubMenu->GetMenuString(nItemID,str,MF_BYCOMMAND);
" It aways tells me wrong ,I don't know why?help!! thanks!
|
|
|
|
|
vernchen wrote: But when compile to the " pSubMenu->GetMenuString(nItemID,str,MF_BYCOMMAND);
" It aways tells me wrong ,I don't know why?
Without an actual error message, neither do we.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I have a function that calculated two int values. I call the function only by using a string and calculated those two int values. I want to return that two int values from the function when I call it with a string.
Look at the following function,
bool CharWordCount(string rtf, int& word_count, int& char_count)
{
}
<pre>
One of my friend say i can do it as above. using the bool type return value. Can you guys give me a help how to do that.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: One of my friend say i can do it as above.
Sure.
Assign the values you computed to word_count and char_count , respectivly.
And read a book like "C++ for Dummies" or "C++ in 21 days". Esp. the chapter about giving parameters to functions "per value" and "per reference".
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
jhwurmbach wrote: Assign the values you computed to word_count and char_count, respectivly.
Yes, that is true and can do that and get values. What I'm asking is can I handle it using a bool operator, as I code on my question.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: What I'm asking is can I handle it using a bool operator
What do you mean? Your code is not showing the bool operator. That would be:
operator bool() const
{
} In your example, you assign the values and return a bool . Thats it.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
You can handle it as void, as bool or as you want. I.E. if you check the values of word_count and char_count before going out that function you can return FALSE if there was an error or TRUE if all worked good.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
The bool value returned by the function has nothing to do with the assignment of the word_count and char_count parameters.
The function suggested doesn't uses the return value to transfer the required info to the caller, it instead directly access the caller variables to the purpose (the bool return value can be merely used to report if the whole operation succeeded).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Ok, I got the point. Now it is clear to me. Thanks fro all your replays.
I appreciate your help all the time...
Eranga
|
|
|
|
|
AFAIK you can not return two parameters at once. You can return a structure having more parameters, you can decide which parameter to return through If, elses. But not to return two different parameters in the same return.
What you are making is giving the 2 Ints as reference to your function, so that when you end and come back to the calling point, you will have the values of your counts in the "parent" scope.
void AnyFunction ()
{
int nChar = 0;
int nWord = 0;
string rtf = GetYourString ();
bool bRet = CharWordCount(rtf, &nWord, &nChar);
printf ("there are %d words and %d characters in the string", nWord, nChar);
}
what you have to code inside the function CharWordCount () is in the answers of your question of yesterday or 2 days ago.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Nelek wrote: What you are making is giving the 2 Ints as reference to your function, so that when you end and come back to the calling point, you will have the values of your counts in the "parent" scope.
Actually I do this in main function. But still what I'm confusing is that, usage of 'bool'
On my main I do this,
int word_count = 0;
int char_count = 0;
WordCount(strRTF, word_count, char_count);
printf("\nWords %d Characters %d", word_count, char_count);
<pre>
I appreciate your help all the time...
Eranga
|
|
|
|
|
As I told above, the bool has no sense in this function, but the possibility to give back a TRUE or FALSE depending on if there is an error or not, or if the parameters have sense or not or whatever else. You can get the bool away and code your function as void without any problem.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Why you didnt use of a structure for return value?
|
|
|
|
|
Generally speaking that isn't a good idea: it is inefficient.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Eranga Thennakoon wrote: One of my friend say i can do it as above. using the bool type return value.
Get a new friend that knows a bool is only 1 byte in size, thus can only hold a value of 256 (assuming unsigned ). Either that or only plan on counting 128 words and 128 characters.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
how can i call the actionscript function using vc++.
|
|
|
|
|
What do you mean with "actionscript"?? (I know actionscript from Macromedia Flash, but in the help of VC++ 6.0 there is no "actionscript")
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
thanks.
i want to call the flash function throught to vc++ code .how to do?
|
|
|
|
|
To call a flash function... I don't know if it is even possible. To call a *.exe flash project, yes, you can call any other *.exe files from VC++. About the *.swf ... I am not sure about.
Maybe with a bit more info about what you want to do, others can help you better than I
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
flash.external.ExternalInterface.addCallback("hidedetails", this, hidedetails);
function hidedetails()
{
setProperty("a row 1",_visible, false);
setProperty("a row 2",_visible,false);
setProperty("a row 3",_visible, false);
setProperty("a row 4",_visible,false);
setProperty("a row 5",_visible,false);
}
above the function in flash. now i want to call this function in vc++.how to do it?
|
|
|
|
|
I think u r using an ActiveX called "ShockwaveFlashObject".
create a member variable for that. And
membervariable.SetVariable("flashobject.hidedetails", "");
Here flashobject is the object(in flash code) to which actionscript code is linked.
|
|
|
|
|
Hi All,
I my project when I run the application then it crash and when I
debug that application then it is working fine. So can any body give me solution to this problem.
Thanks in Advance
am
hi
|
|
|
|
|
Send me u'r project.
Come online at:-
jubinc@skype
|
|
|
|
|
Have a look at http://www.flounder.com/debug_release.htm[^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|