|
hello,
how do i know that the enter key is pressed in CEdit control. Which message notifies this event ?
I want to set focus to another control when Enter key is pressed in the edit control. Can u help plz?
Thankx,
Abin.
|
|
|
|
|
Hi,
You can handle this @ PreTranslateMessage.
Sujan
|
|
|
|
|
I have a video processing application that takes input for a web camera, do something on each frame, and immediately display the result. The application runs quite well in the beginning, with frame rate reaching up to 20fps. The problem is, it seems that the application slows down after it has run for a long time (something in the range of 15 hours or so). At this time, the frame rate is only 4 fps or so. I know it is impossible for someone to pinpoint what the problem exactly is, what I want to know is what are the possible causes for this. I have been scratching my head for the past few hours and the solution still eludes me.
Some information about my application that may be useful:
1. My app is a directshow filter
2. There is no harddisk access involved, as my app only process input frames (obtained from a webcam) and immediately display them on screen
3. I didn't detect any memory leaks, when my app's performance dropped to 4fps, it is only consuming around 10% of the available memory
4. After the performance dropped to 4fps, sometimes the fps count can increase again up to ~8fps, but it never reaches the original fps count (20 fps)
5. I have tested the app on several PCs with different configurations, and all of them exhibit the same behaviour
Thanks!
|
|
|
|
|
3. I didn't detect any memory leaks, when my app's performance dropped to 4fps, it is only consuming around 10% of the available memory.
Two ideas come to my mind:- Could it be a memory fragmentation issue? Do you happen to heavily allocate and free memory for each frame? If so, maybe you can try redesigning your stuff so that memory is reused instead, or something along that direction.
- Maybe you're running out of GDI resources?
HTH
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Indrawati wrote :3. I didn't detect any memory leaks,
Check for other leaks also, different handles like registry, files, thread etc, etc ....
There is no spoon.
mail
|
|
|
|
|
Shouldn't an int only be able to hold 32767 positive integer?
All of the integers a, b and c exceed the limit, and it runs.
The c shows a value of 552222, which is correct.
Could anyone tell me why can it exceed its limit? Thanks.
<br />
int a = 330000;<br />
int b = 222222;<br />
int c = a + b;<br />
<br />
printf("%d\n", c);<br />
<br />
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
16 bit vs 32 bit
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
|
Thanks guys.
This is the code from limits.h
<br />
#define INT_MAX 2147483647 /* maximum (signed) int value */<br />
#define UINT_MAX 0xffffffff /* maximum unsigned int value */<br />
#define LONG_MIN (-2147483647L - 1) /* minimum (signed) long value */<br />
#define LONG_MAX 2147483647L /* maximum (signed) long value */<br />
The INT_MAX state that the max value is 2147483647, this is the same
max value in long int according to "The Complete Reference in C" by
Herbert Schildt. And look, the value of LONG_MAX is the same as INT_MAX
except for the additional L in the end.
Question 1:
Even the sizeof(int) and sizeof(long int) give the same value, 4. Does that
mean int can hold the same amount of integers as long int?
Question 2:
Another interesting fact is that, the max value of unsigned int is
FFFFFFFF, that is 4294967295, which is the double of MAX_INT. And
the value of FFFF is 65535, and that is the max value of what the
book said.
So, FFFFFFFF is 32-bit address, and FFFF is 16-bit address?
Is that right?
Question 3:
Oh, if computer is binary system, why would the memory address represent
in hex?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Alex Ngai wrote:
Question 1:
Even the sizeof(int) and sizeof(long int) give the same value, 4. Does that
mean int can hold the same amount of integers as long int?
Yep.
Alex Ngai wrote:
So, FFFFFFFF is 32-bit address, and FFFF is 16-bit address?
Is that right?
Yep. Or rather, 0xFFFFFFFF needs 32 bits for storage while 0xFFFF needs only 16 bit for storage.
Alex Ngai wrote:
Question 3:
Oh, if computer is binary system, why would the memory address represent
in hex?
I guess you ask why most programmers use hex when working with memory addresses and other unsigned values.
It's probably because it's easy to map hex to binary and back again.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
jan larsen wrote:
It's probably because it's easy to map hex to binary and back again.
yep, but try also to write a 32bits binary address and you will quickly come back to hex notation...
0hF1D5AB7C == 0b11110001110101011010101101111100
choose your side...
TOXCCT >>> GEII power
|
|
|
|
|
He he he, and imagine the fun we would have when coding for a 64 bit machine.
"0b000110000000000000010100000000000000000000000011000000011100 Hmmm, did I miss a 1 somewhere..."
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
How can I declare an integer in binary? We use 0x for hex, what is the prefix for binary numbers if any in C/C++?
ARSALAN MALIK
|
|
|
|
|
Just convert your binary numbers to hexadecimal or decimal notation.
|
|
|
|
|
you cannot do that in C/C++.
the only notations you can use are :
* Hexadecimals ......... 0xHHHH
* Octals ............... \OOO
* Decimals ............. DD
where :
H is one of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
O is one of 0, 1, 2, 3, 4, 5, 6, 7
D is one of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
TOXCCT >>> GEII power
|
|
|
|
|
Correction:
To declare Octals you use 0nnn , where n is one of 0-7
ARSALAN MALIK
|
|
|
|
|
yes, of course !
TOXCCT >>> GEII power
|
|
|
|
|
Well, you kind of can do it in C++
template<__int64 T_val>
struct bin_help
{
template<__int64 T_base, __int64 T_bits>
struct inner
{
__int64 operator()()
{
return (((T_val)/T_base)%10)*(((__int64)2)<<T_bits)+bin_help<T_val>::inner<T_base/10,T_bits-1>()();
}
};
template<>
struct inner<10,0>
{
__int64 operator()()
{
return T_val%10;
}
};
};
template<__int64 T_val>
__int64 bin()
{
return bin_help<T_val>::inner<(__int64)100000000000,10>()();
}
For 10 digits of precision, the C++ compiler (tested with VS.Net 7.1) performs the calculation directly during compilation stage (at least in release builds), so
bin<10101>();
evaluates natively to
mov eax, 21
With 15 digits precision it stopped working, i don't know the real limit but i suppose 10 digits is good enough for the amount of inline function unrolling needed. BTW: Using partial function template specialization this could be solved much more easily (in fact this is planned for the next revision of the standard).
Error handling is obviously missing, so 5192 would also be accepted :-|
|
|
|
|
|
I don't think you can in C or C++, but if you want your part of the code obfuscating fun, you could always do this (in VC++ mind):
<br />
<br />
char the_char;<br />
<br />
__asm<br />
{<br />
mov the_char, 00100000b<br />
}<br />
<br />
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
ARSALAN MALIK
|
|
|
|
|
You can use base-8, base-10, and base-16 numbers only. If you want a number represented as base-2, it must be converted to a string.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How can we delete a function from a class. Back with the VC++ 6, you can choose your function, right click and delete. But what about .net
<italic>Work hard and a bit of luck is the key to success.
You don`t need to be genius, to be rich.
|
|
|
|
|
. I was more concerned when tried to add OnInitDialog() to my dlg class !!!
There is no spoon.
mail
|
|
|
|
|
I guess we have to do it manually.
<italic>Work hard and a bit of luck is the key to success.
You don`t need to be genius, to be rich.
|
|
|
|
|
can someone tell me simply what a version control means for a vc++ project.
any help appreciated.
|
|
|
|
|