|
MSDN does not provide much good STL info. You can step through a map using iterators, like this:
map<CString, int>::iterator it = m_MyMap.begin();
for (;it != m_MyMp.end(), ++it)
{
CString s = it->first();
}
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thank you Christian! Just ran into it searching through yahoo also.
|
|
|
|
|
Don't know why I thought about STL before. I'm loading the whole file into memory and searching for each occurance of a few key words on each access. One thing I found is that you can use a map of vectors, list, etc. which seems alot better, faster and easier.
ATL I'm still lost.
|
|
|
|
|
For ATL I ended up so stuck I bought 'Teach yourself ATL in 24 hours'. Once I read that I had the basics I needed to tackle ATL Internals. Just stick with it, I also read for months when I had no time to play with code, and eventually it all gelled.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I'd need to create a Property list, like that in Visual Studio for C++ and VB...
You all know the Properties window that is basically a two column grid but that lets you set properties on controls and the like.
Has anyone written a class (or is there one?) for and MFC app that will show up in a dockable window?
I don't need a property sheet...which is all I can seem to find...
I actually need something EXACTLY like the one in Visual Studio
ideas?
thanks
mike
|
|
|
|
|
Look in the List Control section here on CodeProject, I was just there.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
I have got a template class. It's called ObArray and one of the datamembers are a pointer to an array of any type of object. At the moment ObArray is just constructing all the objects using the default constructor.
But I always want to have the option to use another constructor to initialize the objects, not just the default one. I want this because it's faster than first creating the objects using te deafult constructor, and then change all the objects. Another reason is that not all classes even have a default constructor, which makes it impossible to create an array of instances of those classes.
The only way I can imagine this to be solves is by sending the constructin info along with the constructing of the array object (ObArray). Since constructors of course take a variable number of arguments, the constructor of ObArray must accept that too.
Like 'ObArray<t>::ObArray(int initLen, ...)', and then this constructor sends the arguments along to the constructor of each of the objects. Is this possible in any way?
Sprudling
|
|
|
|
|
Like 'ObArray::ObArray(int initLen, ...)', and then this constructor sends the arguments along to the constructor of each of the objects. Is this possible in any way?
No. Use placement new instead.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Uhm... I don't really understand what you mean.
I know I can't actually write 'ObArray::ObArray(int initLen, ...)'. I just meant that this constructor could take arguments like that, and pass them on...
Btw... I think I found some sort of solution by using copy constructors, but that requires that the class I want to create the array of has one.
Another solution not requiring that will be better.
Sprudling
|
|
|
|
|
I mean that you should allocate raw memory for all objects first using ::operator new or malloc. Constructors are not called in this phase. You use placement new next to initialize objects in allocated memory. The only problem left is that different classes you're going to put into ObArray may need different number of constructor parameters - you can solve this by providing multiple ObArray constructors, each having different number of params. Assuming that there are max 3 parameters that you need to pass, declaration of ObArray should begin like this:
template <typename T,
typename P1 = void,
typename P2 = void,
typename P3 = void>
class ObArray
{
};
Of course, you can generalize this to use more than 3 parameters in the c'tor.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi...
How can I convert an Integer to LPSTR
here is what I want:
TextOut(hdc, 20, 20, Integer, 5);
|
|
|
|
|
With itoa(nVal, buff, 10);
Where buff is a LPSTR and nVal is a Integer.
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
|
I looked everywhere and tried alot of different things, but I can't
find any code that will help me create a multiline CListCtrl in
report mode. Any ideas? Any suggetsions? Any code?
Any response any one can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
Its possible.
http://www.codeguru.com/listview/ReportCtrl.shtml
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
I sincerely appreciate the reply.
I looked at that demo project and its spectacular, but really different
understand. By chance, do you have a smaller project that isolates the multiple text for one item feature? Or could you help me create it?
I have a CListCtrl and one of my columns has lots and lots of text. Horizontal scrolling to the right is just not doing it. But if I could make the text go to a new line within that same item, then the user could read the CListCtrl clearly.
Please, please any response you can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
While not exactly a programming question, I'd like to know if you can turn off auto-word selection.
What I'm talking about is when you're programming and trying to select text and it will back-up the start and/or finish to whereever it thinks is appropriate. "Word selection" I think they call it. Can I disable this system-wide?
Thanks
|
|
|
|
|
Hi
how can I read a single line from a text-file?
There should be read in so much characters until there is a carriage-return/line-feed.
How to do this?
|
|
|
|
|
CFile::ReadString, fread, etc..
try the MSDN. search for "read a line from a file"
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
ReadString works fine
Thanks!
|
|
|
|
|
There is a simple (and fast) solution for this in C
#include "stdio.h"
FILE *filepointer;
char line[100];
char *kar;
fp1 = fopen("yourfilenamewithpath", "r");
kar = fgets(line, 100, filepointer); //read one line
//kar = fscanf(p, "%s", word); reads just one word until next space
//kar = getc(filepointer); reads just one character
printf("%s", line);
fclose(filepointer);
Bunburry
Education is an admirable thing but it is well to remember from time to time that nothing that is worth knowing can be taught (O.Wilde)
|
|
|
|
|
Sirs,
do you have an idea how to create a view like the output window of Visual C++ with white tabs and client area to write on?
Thank you for your kind help.
Bunburry
Education is an admirable thing but it is well to remember from time to time that nothing that is worth knowing can be taught (O.Wilde)
|
|
|
|
|
See into BCG control, you can find it into CodeProject
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Delphi can not use my lib file so how can I provide dll that I wrote in vc++ to client that works in Delphi ????
My dll exporting c style functions that use in objects of c++ {classes).
So what can I do if I want to give this dll for Delphi ???
|
|
|
|
|
non-MFC clients can only use plain C functions from DLLs. or, you could write it as a COM module. you cannot export C++ functions to non-C++ clients.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|