|
since you didn't use < and > rather than < and > respectedly, i cannot know what your vactor contains. so if my answer is not accurate, please fix your question.
the std::vector<>::clear() function clears the vector, but nowhere calls the objects destructors.
if your vector contains objects (like std::vector<MyType> ), then you manage the life of the objects. calling clear() will only remove the reference (actually, the copy) of the obect in the vector.
if your vector contains pointers (like std::vector<MyType*> ), you have to be more than careful because memory leak are close to occur; especially if you allocated dynamically using new . Using such vectors, you must first iterate over the vector to delete all the contained pointers, and only then call clear() .
ps: please also use <pre></pre> tags when posting code sample so that you keep being formated correctly
|
|
|
|
|
toxcct wrote: so if my answer is not accurate, please fix your question.
Best answer I've heard all day!
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Best answer I've heard all day!
if my answer was that good, then some idiot didn't understood it, because it seems that i've been rated badly (once again)
|
|
|
|
|
I doubt the code will work. It doesn't help that we can see < or > characters in your post! The it-- is crazy and will cause all types of problems.
Steve
|
|
|
|
|
Hi all,
I am using VC6. Is there any easy way to make the font used in the dialog bold (MS Sans Serif)? Especially for all the CStatic's?
I know I can simply use one of the CStatic-derived classes here, but that means I have to declare/initialize/set each member of the CStatic for all my dialogs! This means hundreds!
Thanks for any input.
|
|
|
|
|
In the dialog properties you can set the font for the dialog. That font will then be used by all the controls on the dialog.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
But as I mentioned in my original post, you can't make it BOLD from the properties, can you?
|
|
|
|
|
You did not mention that you tried it from the properties
In VC8 it is possible to it from the properties, but not in VC6. I even tried modifying the dialog resource directly in the rc file by changing the FONT property. I was able to toggle the italic property but not change the weight.
Another easy option is to use EnumChildWindows to enumerate through all your controls and send a WM_SETFONT message to each one.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
thanks a lot. just what i was looking for.
|
|
|
|
|
Joe Smith IX wrote: I know I can simply use one of the CStatic-derived classes here, but that means I have to declare/initialize/set each member of the CStatic for all my dialogs! This means hundreds!
Just how hard is it to use the search/replace feature of the IDE?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It's not hard at all to use search/replace. The problem I was referring to was that I would have to declare EACH and EVERY 'Static Text' as object, then initialize and set the properties of each one of them! Am I correct, or there is a much simpler way?
|
|
|
|
|
Joe Smith IX wrote: Am I correct...
No.
Joe Smith IX wrote: ...there is a much simpler way?
Yes.
Once you have a class derived from CStatic , simply change your dialog's .h file by renaming all references to CStatic to your derived class. In the derived class, see the Extras section of this article.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I am trying to set the VC++ 6.0 Editor so that the EOL is set to UNIX style and NOT windows style.
Please help.
Baidehish Dwibedy
tdwibedy@yahoo.com
|
|
|
|
|
Baidehish Dwibedy wrote: I am trying to set the VC++ 6.0 Editor so that the EOL is set to UNIX style and NOT windows style.
what do you mean ?
where should the EOL be unix style ? in the program ? or in the code editor ?
|
|
|
|
|
How do we handle exceptions in C++/VC++ ?
try catch, __try __except, CExecption etc right? I'd like to discuss on this, anybody up there? good in these?
Ok, as a start up, I'd ask you a simple question,
I divide an integer by 0 UNKNOWINGLY that we are not going to make a manual *throw* anywhere. It should be handled. how do we do that?
__try
{
int i=10;
i=i/0;
}
__except(char* ex)
{
//But the hell now comes here
}
something like that? And why someone would go for structured exceptions? Should we design our own exceptions on our own? Why not it's like the way it is in C#
286? WOWW!
|
|
|
|
|
Probably better to check the value you're dividing by in this situation, but if you must use exceptions you could do something like:
int i = 10;
try
{
i = i / 0;
}
catch( ... )
{
// do whatever you need to do to handle the situation
i = 0;
}
// use i
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks steve, but it's not entering the catch block, rather, the debugger makes a break at the line and pops up an "Unhadled Exception, divide by 0 error".
286? WOWW!
|
|
|
|
|
that's because such a mathematic fault doesn't throw an exception.
some function however do handle the "division by 0" case and send a related exception; native operators don't have such an implementation, and you should test yourself that you're not dividing by 0 before actually do the operation...
|
|
|
|
|
void main()
{
int i=3;
__try
{
i=i/0;
}
__except(GetExceptionInformation())
{
printf("Gotcha!");
}
_getch();
}
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
. Thanks.
286? WOWW!
|
|
|
|
|
That is strange code. It's normally done like this:
int main()
{
int i=3;
__try
{
i=i/0;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
printf("Gotcha!");
}
_getch();
return 0;
}
Or even better:
bool IsDivideByZero(DWORD code)
{
return code==EXCEPTION_FLT_DIVIDE_BY_ZERO || code==EXCEPTION_INT_DIVIDE_BY_ZERO;
}
int main()
{
int i=3;
__try
{
i=i/0;
}
__except( IsDivideByZero(GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH )
{
printf("Gotcha!");
}
_getch();
return 0;
}
Steve
|
|
|
|
|
This is quite clear! Thanks Stephen
286? WOWW!
|
|
|
|
|
In standard C++ catch(...) will not catch hardware exception by design: divide by zero should not be caught by your code on standard compliant compilers. MSVC6 was non standard in this area (and many, many others). Later MS compilers fixed this bug but provides the /EHs[^] switch to use the old buggy exception handling semantics. In short, using catch (...) like this is a worry (I'm of the opinion that you should almost never use it anyway).
Steve
|
|
|
|
|
How can I write something somilar to a MDI application (using Visual Studio) where:
*Document is write in C++ to have fast routines
*View/ frames/ menu /other grafic tools are writed with a different lenguage (as C# or VB NET) to use in a more easy and fast way objects like image editing tools/data tables/... (and ... to split this job with other people)
Can .NET help me?
any articles that shows detailed procedures?
any lectures?
thanks
Cheers,
Russell
|
|
|
|
|
Hi!
In runtime suppose I want to identify the handle of one main window and the child controls window like combo,listview and button which is inside the main window. How can I check whether it is main window handle and it is control window handle?
Amit Mistry - petlad -Gujarat-India
|
|
|
|