|
Please we lets type the threads in English language what become partner language in the world.
Bitte tun Sie mir nicht antworten, wenn Sie nicht wissen, die Ursache des Problems wirklich oder nur als Antwort. Was ist das? Dies ist das Buch sitzen.
|
|
|
|
|
Hey, it wasn't me who started it...
I just didn't want to miss the fun
Florin Crisan
|
|
|
|
|
Hello all,
When you have two classes and one of them inherits from the first one [CB inherits from CA], you can use functions in the parent class [CA] by setting them as virtual and protected or public from the child class [CB].
I would like to know if I can do the same with Windows messages.
What do I need is to be able to process the message in the parent class [CA] and not in the child class [CB] without calling the CA event:
I don't want to do this:
void CB::OnSize(UINT nType, int cx, int cy)<br />
{<br />
CA::OnSize(nType, cx, cy);<br />
}
Can this be automated?
As always thank you in advance.
|
|
|
|
|
Joan Murt wrote: When you have two classes and one of them inherits from the first one [CB inherits from CA], you can use functions in the parent class [CA] by setting them as virtual and protected or public from the child class [CB].
Well if your inherited class overrides base class virtual functions, the base ones will NOT be called implicitely.
Joan Murt wrote: I would like to know if I can do the same with Windows messages.
You have to do it explicitely.
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.
[my articles]
|
|
|
|
|
I've searched for that on the Internet and not found anything and thought to ask for it here but without a lot of hope...
Anyhow this is not a lot of job so it's OK.
Thank you CPallini.
|
|
|
|
|
Hello everyone,
I am wondering except when there is no memory on heap, are there any other situations when we will get bad_alloc exceptions? For example, invalid input of the size (e.g. very huge number or zero or negative number) will cause exception?
thanks in advance,
George
|
|
|
|
|
MSDN http://msdn2.microsoft.com/en-us/library/6512dwes(VS.71).aspx[^] is a bit laconic about, but seems to go on the way you depicted. BTW, Why don't you make a little test and tell us your findings?
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.
[my articles]
|
|
|
|
|
Hi CPallini,
It seems bad_alloc only occurs when there is no memory or not enough memory (as showed in the sample). And we can not input invalid value, like -1, compiler will fail. Do you agree with me?
BTW: what situations do you find you met with bad_alloc?
regards,
George
|
|
|
|
|
George_George wrote: It seems bad_alloc only occurs when there is no memory or not enough memory (as showed in the sample).
Maybe, see the following lines.
George_George wrote: And we can not input invalid value, like -1, compiler will fail. Do you agree with me?
Well, a negative integer is casted to a size_t one, that is an unsigned one, since -1 turns out to a very big unsigned value (4294967295), the compiler is able to detect the error. But a silly trick like the following
int *p;
int a=1;
int b=rand()> RAND_MAX / 2 ? 1 : 2;
try {
p= new int[-a*b];
}
catch(...)
{
printf("Exception, George!\n");
}
makes the compiler happy but an the exception is thrown at run-time.
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.
[my articles]
|
|
|
|
|
Thanks CPallini,
Cool!
regards,
George
|
|
|
|
|
Did you check when you want to allocate memory?
|
|
|
|
|
Thanks Hamid,
What do you mean check? Check what?
regards,
George
|
|
|
|
|
When you want to allocate dynamic memory did you check for example use of try/catch?
|
|
|
|
|
Hi Hamid,
Which example do you mean? URL please?
regards,
George
|
|
|
|
|
No I said for example use of try/catch not Example.
|
|
|
|
|
Hi Hamid,
I am confused, which sample do you mean? If you mean anything of this forum, could you provide a link please?
regards,
George
|
|
|
|
|
No I said (for example) not a example.dont worry
|
|
|
|
|
dear all
how to set path in setting of option? anyone has experience or some detail to introduce this? thanks a lot.
Li Zhiyuan
5/1/2008
|
|
|
|
|
What are you talking about ?
|
|
|
|
|
Hey Tox, was you on vacation, wasn't you?
Happy New Year and best wishes.
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.
[my articles]
|
|
|
|
|
yup, and to be fully exact, I'm still on vacation.
I was off from Codeproject because I went to Lithuania for the new year
|
|
|
|
|
Do you mean additional search paths for include files?
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.
[my articles]
|
|
|
|
|
yes, you are right, when we go to tool-> option, we can see executable file..but we also can choose include file, how to set the path there? i encountered a problem, after compilation,output showed me:
fatal error C1083: Cannot open include file: 'Centroids.h': No such file or directory
so i dun know how to set this path.
thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
Well, IMHO, the best behaviour will be to put your Centroids.h header file inside the project source folder (where is, for instance Centroids.cpp ) and then use:
#include "Centroids.h"
into Centroids.cpp .
However, if you really need to put Centroids.h in a special folder, then, adding such a folder to the VC++ include directories isn't difficult:
(1) Choose Tools->Options menu item
(2) Select Project and Solutions->VC++ Directories node.
(3) Select Include Files item in the Show Directories for list.
(4) Choose the New line (folder icon) button or press CTRL+INS key combination.
(5) Add the path of the folder wherein Centroids.h is (you can browse for).
(6) Enjoy compilation (remember the #include "Centroids.h" in the source code)
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.
[my articles]
|
|
|
|
|
yes, actually i did like this already, centroids just is a class in my header file... i installed vc++ 2005 in D driver, but my project in C driver..so i added a direcotry included my project in C driver...but the problem is still like this
Li Zhiyuan
5/10/2006
|
|
|
|