|
nobaq wrote: I need to display ~ 100000 entries in a windows list...
Why? Who would want to navigate through such a list?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Just look at winhelp32 fulltext- or keyword search.
This is exactly what I want to implement.
Regards,
Niki
|
|
|
|
|
Use a CListBox,in virtual mode.
If I remember correctly, You will need to manually draw and manage the data, but it will make the CListBox
very fast; once you know how to do it, you will use it everywhere.
You will need to override the CListBox::DrawItem (and maybe the CListBox::MeasureItem )
|
|
|
|
|
Hi, thank you for this hint.
I've been searching for a while now but I can not find any docs
Do you have a reference, docs, howtos for subclassing CListBox in order to implement a virtual listbox?
Any anyway, how do I query data from my database when "scrolling" very fast? I think i need to minimze my database queries but on the other hand I need to display something while scrolling...
Regards,
Niki
|
|
|
|
|
Hi
I've searched documentation and I can't find any answer to my problem.
I'm trying to burn an iso image. I call SHCreateStreamOnFileEx to get a stream from file and pass the stream to DiscFormat2Data->Write.
It all works fine but is there any way to set the name of CD ?
Currently when I'm opening an iso file, for example "NAME_DIGITS_MORE_DIGITS.iso"
my CD is called "NAME". I would like the disc to have the same name as the image.
I saw the function put_VolumeName but I can only use it when I'm creating an image myself.
The iso I'm trying to burn are made by other application
Can someone help me?
|
|
|
|
|
In which case CWnd::SubclassWindow(HWND DocumentList) fails, I have locally declared and initialized DocumentList which is used as the the parameter?
Software Developer
Sanjay Khapre
modified on Wednesday, January 7, 2009 10:03 AM
|
|
|
|
|
It can fail if it gets a non-valid HWND as parameter (like for example NULL) or if it gets a window that already has something attached to it (instance of another CWnd derived class). These are what i can think of now. But place a breakpoint, and step into that method and just trace down where it fails.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
I have inherited some old code. Our sadistic project management has decided to forbid use of MFC in the hope of being more portable. I replaced all the CStrings with string, now I have got some tricky parts left.
The guy who wrote this used CMapStringToOb in what seems to be a very clever way and I think it is a fine piece of code. But I have to replace it - but with what? I can't use CObjects any more.
I have things like this:
CString csMsgID;
pCommand SACommand; //(which is a CObject)
CMapStringToOb m_knownCommands;
m_knownCommands.Lookup((LPCTSTR)csMsgID, (CObject*&) pCommand)
m_knownCommands.SetAt((LPCTSTR)csMsgID, apFba[i]);
I suppose I could plod through and dream up something complicated and slow, but does anyone have an idea how to do this in an elegant manner? Is this what the type Object is for?
-------------
Bibo ergo sum
|
|
|
|
|
RedSonja wrote: I have inherited some old code. Our sadistic project management has decided to forbid use of MFC in the hope of being more portable.
I'm definitely not an MFC fan, anyway I think your management deserves a kick in the ass.
Must you be stuck with C language or may you use C++ ?
With C++ , you may use STL containers. If you need to use only C , then I suppose you should search for a library offering hashing functions.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Oh, yes, we can use STL containers. Which do you recommend?
(I am not really lazy, but I do not usually program this high up in the food chain, and my boss wanted it done in December.)
-------------
Bibo ergo sum
|
|
|
|
|
I guess using a std::map would do the trick. The problem is that you won't be able to use CObject as a base class, but anyway it is quite ugly anyway. If all the objects in your map have the same base class, then it is fine. If your map needs to store different kind of objects, then probably you need to think the design a bit better...
|
|
|
|
|
std::map< std::string, YourRootClass * >
However, as already suggested by Cedric Moonen, maybe better to re-think a bit about the project design (I know it would require experience, time and effort) than mimic the MFC behaviour.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hmm, you are quite right. Looking at the code a bit harder (I was scared off by CMapStringToOb looking so complicated) I can see he has nothing more than a list of objects derived from the same class, nothing more than that. So I can try with std::list and do the clever bits in a simpler way.
I was hoping to avoid changing every single reference to the things (this is a very large amount of code), but it has to be done, and this week no-one is there to ask what I'm doing. I have redesigned this project quite a lot since it landed on my desk, and this is just about the last untouched corner.
-------------
Bibo ergo sum
|
|
|
|
|
RedSonja wrote: I can see he has nothing more than a list of objects derived from the same class, nothing more than that. So I can try with std::list and do the clever bits in a simpler way.
It is a bit more complex than just a list. It is a map which associate each object to a key (being a string). No duplicate key can be found in the map.
To begin working with a std::map, you can look at these tutorials: here[^] or here[^]. You can probably find hundreds of tutorials on the net if you google a bit.
|
|
|
|
|
Yes, I spotted the key, I need some of those too. Thank you for the tutorials, I shall have a look.
-------------
Bibo ergo sum
|
|
|
|
|
Hi.. i want to write xmlwriter function for writing in xml file in c++.Is there any MFC class by which i can implement it or any sample code as reference.
Thanks
amit
|
|
|
|
|
Don't think MFC has any XML functionality built in.
If you're just writing XML, genx is very easy to use.
Other options include MSXML or libxml2 (which has an XML writer API). I personally don't like MSXML too much for C++, as calling it via COM is a bit of a pain.
|
|
|
|
|
If you need to write some simple XML then you can hand-craft it (writing XML is far simpler than reading -parsing- it). If you need a full-fledged XMLWriter then you may use a library, as suggested by Stuart Dootson.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: If you need to write some simple XML then you can hand-craft it
To be honest, I'd always recommend using a writer, as it'll (hopefully) remember to do things like specifying the file's encoding, closing tags, quoting text etc. The quoting text bit, especially, is very easy to forget to do or, even if you remember it, easy to get wrong.
|
|
|
|
|
All do you need then is an XML validator tool. IMHO Writing hand-crafted XML has some educational purposes too.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for reply. I have looked for msxml for doing xml operation. I have my parser reader function I need to implement writer function or function to modify existing file. So if I had an xml document and I want to move to specific tag given its ID. Would I have to iterate through all the nodes until I found the tag with the id I wanted or is there a quicker way in msxml. I have read its sdk but fails to find anything regarding this.
Thanks
amit
amit
|
|
|
|
|
No, you haven't to. You may search for nodes, see for instance [^] or [^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Whats the size of each pixel of a bitmap in memory?
|
|
|
|
|
I suppose it depends on color depth...
See BITMAP struct definition [^], the bmBitsPixel member looks promising.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I was thinking it depends on the resolution...
|
|
|
|