|
you must create an object of that class to use the combobox.
try this:
CDialog2 ob;
ob.m_cCombo.ResetContent();
Best Regards
Sonu
|
|
|
|
|
Thanks.
That has worked in that now I get no errors when I compile. But when It runs I get a debug assertion failure in File afxwin2.inl at this line (741)
{ ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); }
Does this have something to do with the properties of the ComboBox?
Thanks for you help.
Aoife
|
|
|
|
|
check the resource id for the control and for the window...
Best Regards
Sonu
|
|
|
|
|
Hi!!
Is there any "good" open source messenger type application available in C++/MFC (except sonork). For sonork the source code of server is not available. So please inform me about any other you aware of. Actually i was given a task to design a messenger from scratch and i just want to take help of example code.
|
|
|
|
|
I am writing a database application in which I want to get the data from a table.I am getting the value of that field in other tables but couldnt get it from the table in which
32 filds are there.I am using MS Access database.Why i am not getting the same field from a big table?
I am opening the recordset like this.
RS->Open(CRecordset::snapshot,_T("[BO_RBM_LONG_DUR_CALLS]"),CRecordset::readOnly);
what is the problem?Please help me.
Thanks
Pathi
|
|
|
|
|
i need to create SDI frame work in Dll.
if any one have the way to it plz help me.
|
|
|
|
|
I was looking through the help for " _lfind " function but having trouble using it. Could anyone help please?
This is my situation
I have three CString Variables:
m_strEnterData, m_strFindData, m_DisplayResult
m_strEnterData has the input string.
m_strFindData has the string I am searching in m_strEnterData.
m_strDisplayResult is where I want to display the result
I saw the syntax for _lfind in the help but having trouble fitting it for my scenario. Can someone help ?
The reason, I was having m_strDisplayResult as CString is because I got to display a message back saying whether the data is found or not.
Thank you so much.
M
|
|
|
|
|
The scenario sounds like a simple (sub)string search... If so, I do not believe that ::_lfind(...) is what you will want to use.
For example, if you need to look for m_strFindData in m_strEnterData , then you could just do this:
int iWhere = m_strEnterData.Find( m_strFindData );<br />
<br />
if( iWhere != -1 )<br />
{<br />
m_strDisplayResult = _T( "Match Found!" );<br />
}<br />
else<br />
{<br />
m_strDisplayResult = _T( "Match NOT Found!" );<br />
}
Peace!
-=- James.
(Try Check Favorites Sometime!)
|
|
|
|
|
ok... "yes, this is a game" last one i prgrammed, though, wasnt a game "im just trying to learn
ive made a header file and called it drpgf.h for data rpg files.header
this is some of my code:
_____________________________________
struct Counters
{
char cname[100] //counters name
int chp // counters hit points
};
void Monsters()
{
Counters goblin =
{"goblin", //cname
25 // chp
};
}//end Monsters
____________________________________
now in my cpp file... how would i recall the info that i made in my header...
i want to do somthing like this:
_____________________________________
Monster()
cout << goblin.cname[100] << endl;
but it says that goblin doesnt exist...
i would post all my code,... but CP mutilates it
please help...
Thanks!
~SilverShalkin
ps... i guess i could check the "display this message as is (no HTML)
if you guys need more info.. ill just do that
|
|
|
|
|
SilverShalkin wrote:
ps... i guess i could check the "display this message as is (no HTML)
Yeah, there's a thought.....
SilverShalkin wrote:
void Monsters()
{
Counters goblin =
{"goblin", //cname
25 // chp
};
}//end Monsters
Of COURSE you can't access goblin in your cpp. It doesn't exist !!! If you call Monsters, then goblin will exist between you making the call and the next line. IF monsters is a function inside a class, then Counters needs to be a member variable. If monsters is a global function then you could make the variable static. Another approach is to use namespaces to safely make it global.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
I would like to clarify what Christian Graus said.
Because you declared and initialized your struct goblin inside of a function, the scope or visibility of the variable goblin is restricted to inside the function Monster. You can solve this problem by simply making the variable goblin a global variable, then it will be accessable from the global scope.
However the correct way to declare a global variable is to actually declare the variable in the cpp file, and redeclare a copy of the variable with the extern keyword in the header file, like this:
struct Counters
{
char cname[100]
int chp
};
extern Counters goblin;
Counters goblin =
{
"goblin",
25
};
This will prevent linker errors from occuring if you include the header file in more than one cpp module.
The only problem with declaring global variables is that they pollute the global namespace. If you are going to distrubute the modules that you write to other people then I would suggest that you include your variables and functions in a namespace. However if you are simply writing this code for yourself, then it is probably not necessary.
BTW, here is how you would put your global variable goblin in a namespace:
namespace drpgf
{
Counters goblin;
}
You can replace drpgf with any name that you would like.
If you want to access the goblin variable outside of the scope of the drpgf namespace, then you will have to reference it with the namespace operator (: like this:
drpgf::goblin.chp = 100;
One more thing, in order to format your code properly, you can put <PRE> and <'/PRE> tags around your code to format it the way that I have.
I hope this is helpful.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
So... i have to declare all my goblin stuff in my cpp? if so... that defeats thee intire purpose of using the header file,... except the structure.
how would i declare everything in my header and beable to recall it in my cpp file?
Thanks!
~SilverShalkin
|
|
|
|
|
You've missed the point totally. Can I say AGAIN that you need to wake up to yourself and accept that you are a beginner and should learn with beginner projects ?
I feel so uninspired to try to help you when you won't help yourself.
You can't see your goblin because it is local to a function. I dunno if the function is global or if it's part of a class, but a variable defined in a function is visible only in that function.
Like this:
header file
Goblin * TheRedGoblin;
class Foo
{
public:
Foo();'
~Foo();
int IAmTooStupidToLearnTheBasics();
void IWillNeverGetAnywhereAsAProgrammer();
Goblin * m_TheGreenGoblin;
}
cpp File:
Foo::Foo()
{
m_TheGreenGoblin = new Goblin();
TheRedGoblin = new Goblin(); // Terrible design, will only not leak memory if this class is a Singleton.
}
Foo::~Foo()
{
delete m_TheGreenGoblin;
}
int Foo::IAmTooStupidToLearnTheBasics()
{
Goblin * SomeOtherGoblin = new Goblin(); // this is a memory leak
return 768;
}
void Foo::IWillNeverGetAnywhereAsAProgrammer()
{
m_TheGreenGoblin->KillSomeone(); // Fine, it is a member variable
TheRedGoblin->KillSomeone(); // Fine, although a global variable is a bad idea
SomeOtherGolbin->KillSomeone(); // Compiler says what the hell are you talking about, there IS no 'SomeOtherGoblin, and there never was, unless you called
// IAmTooStupidToLearnTheBasics(), in which case it existed only within that function.
}
Do you get it now ? Please, PLEASE, wake up to the facts here. There is nothing wrong with being a beginner, and I'd love to help you, but because you refuse to take the time to learn this stuff properly, you will always suck and so will your games.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
I think that you may have a few good points that you are trying to convey to SilverShalkin but you are not doing it very tactfully and I sense a little bit of frustration or possibly hostility in your messages.
Are you trying to discourage him from trying to learn how to develop or do you think this is the best way to motivate him? I have no problem helping SilverShalkin, and he seems to only frustrate you, so if you just want to ignore his posts in the future I will make sure that his questions get answered.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Doesn't it frustrate you that this guy has *no* idea about absolute basics *AND* refuses to take the time to learn ? I've been helping him for weeks, I spent ages discussing possible beginner projects with him and it appears after all that he did not bother.
I guess I came across a little frustrated, that's because I am. I have no trouble with helping absolute beginners ( I was on fairly recently, after all ), but I can't understand why this guy refuses to learn the basic skills he needs before embarking on the sort of thing he seems to be attempting. I hope my post shocks him, it appears the only way left to try to encourage him to take the time to actually learn some C++ before he tries to write a game in it.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
I am really only trying to help him get a grasp on the language, whatever he wants to do with it after that is up to him. I believe that the current project he is trying to develop is a text based RPG in the console.
I think that he'll learn on his own that he needs to gain more experience in the basics. The way that I got a firm grasp of the concepts was by making mistakes, and figuring out what I needed to learn more of. I think that he will get it, he is just going about it a different way than you did, but I do know that he is learning, and I think that is the whole point of this is teaching and learning.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
I believe that the current project he is trying to develop is a text based RPG in the console.
Would it be your advice that this is a suitable first ever C++ project ???
kilowatt wrote:
I think that he will get it, he is just going about it a different way than you did, but I do know that he is learning, and I think that is the whole point of this is teaching and learning.
I guess you're right. I realise that some people need to fall on their face before they realise they need to take a step back. I help a lot of people here, and I don't think anyone has ever frustrated me to the point of a reply like this one did. I just hope that someday he actually takes the advice he asked me for and then ignored.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Christian Graus wrote:
kilowatt wrote:
I believe that the current project he is trying to develop is a text based RPG in the console.
Would it be your advice that this is a suitable first ever C++ project ???
I wouldn't suggest doing a game for a first project. I think that if your in school or at a job and you can go about learning something pragmatically I would choose a series of controlled simpler programs that could be coded in about an hour for a beginner.
I think that SilverShalkin is learning how to program for fun, and I think the fact that he has a program that he is interested in will drive him to learn all of the things that he needs in order to accomplish what he wants, in this sense I think it is good to have a little instant gratification. I have done this before too. Start a project that I do not know how to do everything, do what I can, and learn what I need to in order to do what I want, even if the entire code is not as good as it could be.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks. "both of you" the response was funny and i dont care what people say,.. "it will never be harsh to me" not that i like it. "well some times, like this time... its only funny" not like im doing it to lauph at you "cristian" i doit for the purpose of the question... which is "by your wording" is the correct way to go out and learn.
you said somthing like "this is to cristian": I like to start projects i have no clue how to do, FOR THAT I CAN LEARN SOMTHING NEW! give you a roses are so cool. any ways, yes i am stupid for trying to learn, it isnt the first time you have made this point clear... "probably not the last"
now,... my goal here isnt to frustrate any one "but my self" so if any of my messages frustrate any one on this forum... you can either
A.) ignor them and go on "no need to waist time"
B.) answer the question that was asked.
C.) answer the question like a know it all.
i prefure (B) because,... the answering doesnt take up that much time. and it gets the point across. It is most helpfull... "and some more that i cant thing of at the moment"
you must except the fact that people may not be as advanced as you are. "take note, that they are trying" thank you.
Cristrian, I have always bean thankful for your help, and i believe that others have also bean thankful for it as well. so wether i get the answer through total sarcasm or strait forward... I still get the answer to my problem.
You are so lucky to be able to go and help the people on this forum,... and not like me "depend on them" I cruise the forum every day looking for a question that i could help on... like one of my first question "how do you make an if statment" man,... that must of bean a stupid question to you all... but through everyones help... i can do a ton more than i could of.
Thanks everyone for helping
~SilverShalkin
I give a to everyone for help.
I give a to every one for realising their ability
And finally i give a to all the know it all's that just
dont understand the big picture.
|
|
|
|
|
SilverShalkin wrote:
I like to start projects i have no clue how to do, FOR THAT I CAN LEARN SOMTHING NEW!
Hell, most of my projects are like that. But a man why tries to learn the lambada but for some reason never learned to walk is bound to look silly. That's all I am trying to say.
SilverShalkin wrote:
you must except the fact that people may not be as advanced as you are. "take note, that they are trying" thank you.
Of course, it's to help people who are learning that I post here at all. ( in the forum I mean )
SilverShalkin wrote:
yes i am stupid for trying to learn
NO, NO, NO. You are BEING foolish to not take the time to learn some elementary skills before tackling this project. But kilowatt is right, if you don't have the dedication to do that, a couple of totally awful and badly designed games are better than no code because you can't be motivated to code anything else. BTW, I cringe when I look at my code from two years ago, so 'totally awful' is I suspect something we all have to look back and deal with
SilverShalkin wrote:
You are so lucky to be able to go and help the people on this forum,... and not like me "depend on them"
I started with comp.lang.c++, a totally BRUTAL place to make mistakes like asking about Windows specific functions by accident. I put up with the brutality because still today most of those guys run rings around me in C++. I learned what was appropriate, did the exercises that people recommended, and learned C++. Then I started programming for Windows and used forums like CP to learn. I'm not lucky, I've worked damn hard. There's no reason you can't aspire to do the same.
Just to recap.
1. I was very rude to you this morning and I apologise. kilowatts last post has made me realise that even if you're learning by a sub optimal path, if that's the only one you're capable of, at least you're learning and trying. And most important, asking questions, I've never wanted to discourage anyone from doing that, although I've been disappointed that you sometimes don't accept the answer.
2. I didn't mean you were stupid, rather that you're taking a stupid path. But if you choose that path I will continue to be happy to assist you
3. I am far from being an advanced programmer, nor am I gifted. I just work hard. There is nothing magic about it, and the fact that so many people helped me is another reason I am keen to be helpful now that I have some skills under my belt also.
So are we all friends again ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
We be always friends
I dont try to ask the questions that are to advanced... ill be at a point of understanding somthing then there will be one error in my program,... ill change somthing then i have 15 errors... completly confused ill jump on CP to try to understand what i was doing wrong "that somthing that doesnt feel advanced" and get chewed out because the question was iether really stupid... that somthig of the basics could teach me... or extreamly advanced.
But thats life... i progrssing through little wierd projects like you said to do... ask kilowatt if you dont believe me. and im just taking the things that i learn by doing that and aply them to a little game.. to further my understanding of them.
Also... i have programmed allot of things... i would list them... but ive got to go
See ya
Thanks for the help "always"
~SilverShalkin
for the help
|
|
|
|
|
simply redeclare your global variable in the header file with the extern keyword.
example:
You declare your variable in the cpp file, outside of a function like this:
// Declare this as a global variable in the cpp file.
Counters goblin = {...};
Then inside of your header file you declare the variable like this:
// You do not need to initialize this declaration of the variable, that is already
// taken care of in the cpp file.
extern Counters goblin;
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Can someone show me how to use this? No matter what I do it always returns 50 - "The request is not supported." This is on VC6 and Win2k sp2.
Thanks, Lac
|
|
|
|
|
Hi all.
I have a very large program the uses OpenGl . My problem is that when it is minimised it chews up a large amount of memory. About 1 Gig in 15 secs.
Is there anyway I can use the debugger to find out where this memory is being allocated rather than trace through thousands of lines of code????
Thanks
Coremn
|
|
|
|
|
there r many ways to it. u can use tools like purify/quantify to get it. simplest is, if u r using C++ and allocating memory using new, then overload the new operator and before and after assigning memory, puts some entris in the log file so that u will know where and what u r doing. u can write the overloaded operator in such a way that this overloads only during debug time.
if u r using malloc, bit tough, have ur own memory allocation funtion and call this function, and inside this function call malloc.
|
|
|
|
|