|
Your problem is in the call to GetEditCtrl() . Once that function returns, the CEdit& is not guaranteed to exist. You need to save that to a variable if you want to use it later.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I changed to
CEdit& myEdit = GetEditCtrl();
and then
myEdit.SetWindowText(tmp); // instead of GetEditCtlr().SetWindowText(tmp)
And I get the same bug. It looks like SetWindowText() works, (I can see the scroll bars growing), but I can't see the text.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Demian Panello wrote: ...but I can't see the text.
Has its color been changed to match the background?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
No.
I'm trying to find the problem, but I can't.
I have commented all the lines in the OnUpdate() handle and just write:
myEdit.SetWindowText("Hello");
well, I get the same bug, it looks like "Hello" is printed in the edit view, (the caret has been moved) but I can't see the text. I have not changed the color.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
I FOUND THE BUG!!!
My stupid bug!! :->
When my View was a CView, I had overwritten the OnPaint() handle!!!!
And then I move my view to CEditView but the OnPaint() handle still there!!!!.
Now I have removed the OnPaint() handle, and everything works fine.
Sorry about my stupid bug and thank you very much for your feedback.
This forum is the heaven!!!
And all of you are Gods.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Demian Panello wrote: "I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup,
Did he really say so?
Maxwell Chen
|
|
|
|
|
Yes he did it.
But I don't know where I have read it.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Maxwell Chen wrote:
Did he really say so?
You might try his Web site.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: You might try his Web site
Maybe I would write an email to him. He taught me a lot many years ago.
Maxwell Chen
|
|
|
|
|
;P
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Hi,
I'm a newbie to C++ and I'm working through the accelerated C++ book by Andrew Koenig/Barbara Moo. I have come to an excersie where you are asked to write a program where the main container for the program could be implemented either as a list or a vector by using a typedef, even though the code is written once. I understand typedefs but I can't figure out how to implement this. Does anybody have any pointers (excuse the pun) or hints as to the solution?
Many thanks!!!!!!
Chris Smith.
|
|
|
|
|
typedef std::vector<int> IntColl;
With this in place you can now use IntColl instead of std::vector<int>.
Steve
|
|
|
|
|
Thanks, but how could a typedef be used to implement either std::vector<int> or std::list<int> in the same program.
For example:
std::vector<int> coll;
int i;
while (read(cin, i))//custom read function
coll.push_back(i);
//rest of code to deal with contents of coll
How could the above be implemented as a list or a vector using a typedef?
One hint in the book is to write driver functions to solve the problem?
|
|
|
|
|
As long as you only refer to the collection's type by its typedef ed name you can change the collection used by altering the typedef and not the code (as long as the new type supports all the operations used). This is standard practice. It is an example of the rule of thumb that, where possible, all design decisions should be represented in a single place and not scattered through the code. In this case the choice of collection is located at the typedef and not scattered through the code. I assume this is what the book is getting at.
Steve
|
|
|
|
|
Yes that is what its getting at but I can't understand how you can do that. If you used an if statement to assign the typedef or a separate function that assigns the typedef, either case would result in the typedef being out of scope for the main code?
|
|
|
|
|
That's not how it works. If you want to change the container you would change the typedef in the code and recompile.
Steve
|
|
|
|
|
|
Friends,
I want to do some basic work with XML document in C++, like loading, saving, inserting nodes e.t.c. Raw DOM is somewhat difficult for me because there is too much COM vocabulary involved in it. I am in search of some DOM wrapper or stand alone XML parser that can help me. There are few parsers and DOM wrappers available here, each having their own pros and cons but i cannot decide which one to use.
Can you please suggest me some DOM wrapper or other XML parser that is easy to use and reliable.
Thanks.
|
|
|
|
|
I use CMarkup[^] in my projects.
Kelly Herald
Software Developer
MPC
|
|
|
|
|
|
I just switched to TinyXML a couple of hours ago - after having used CMarkup for years - and it seems to be faster, at least at creating an xml document and saving it, which was my main concern. Tiny's structure is a lot more intuitive than CMarkup, I think - I was getting lost in IntoElem and OutOfElems of CMarkup.
Just my 2 cents...
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Word of advice. Use the smart pointers provided by the MSXML DOM and implement it yourself. My reasoning is, it is much less painful than "RAW" C++ DOM, (still COM based but much less overhead and coding) and wrapper classes over wrapper classes will likely encourage very inefficient parsing techniques. You really need to know as much about the mechanism as possible to ensure you write the most efficient parse for your documents. You can literally build a parse that takes minutes when a proper DOM Walker will breeze through it in under a second. Some people accept poor performance only because they brute force it.
Also, some butt ugly memory leaks can ruin your accomplishments when dealing with other people's wrappers (or your own) and not fully understanding COM (specifically BSTRs, VARIANTs, and SAFEARRAYs) and the rules for managing allocated resources.
Download the MSXML 4.0 SDK and the documentation and in the html help, go to the /DOM developer's guide/"How do I?"/Program with DOM in C++ using smart pointers/Query nodes from DOM(smart) which is a very simply starting point. The DOM reference is about as good as it gets since the C++ community really never embraced XML. I think I've got the only book published for XML using C++ and it is about as worthless as they come.
Good luck
|
|
|
|
|
|
Hi,
I would like to browse all files&folder under Quick Launch for all users instead of only some certain user. Because different user was allocated with different path for Quick Launch, I have to use pidl to browse for all users. Unfortunately, I didn't know how to get its pidl by SHGetSpecialFolderLocation because I don't know the CSIDL value that identifies the folder of interest.
Does anyone know it? I would really appreciate it.
Nothing impossible, Nothing sure
|
|
|
|
|
I know I can remove frequent programs list by modifying registry. but I would like my program to get frequent programs list so that I can hide some of them. So does anyone can help me on the two question below
1. How to get frequent programs list so that I can get path for each program.
2. How to hide the virtual folder in frequent programs list. If there is a virtual folder provided by a shell extension, how can I hide it?
Your help would be greatly appreciated.
Nothing impossible, Nothing sure
|
|
|
|