|
Here I am using below code to contineously checking for the messages.
<br />
MSG msg;<br />
<br />
while(1)<br />
{<br />
<br />
if(!PeekMessage(&msg,m_hwnd,NULL,NULL,PM_REMOVE))<br />
{<br />
CheckUpdate();<br />
}<br />
else if(msg.message == SCREEN_UPDATE)<br />
{<br />
<br />
RECT rect;<br />
rect.left = (SHORT)LOWORD(msg.wParam);<br />
rect.top = (SHORT)HIWORD(msg.wParam);<br />
rect.right = (SHORT)LOWORD(msg.lParam);<br />
rect.bottom = (SHORT)HIWORD(msg.lParam);<br />
<br />
<br />
<br />
<br />
m_region.AddRect(rect);<br />
<br />
<br />
<br />
<br />
}<br />
else if(msg.message == MOUSE_UPDATE)<br />
{<br />
MessageBox(NULL,CString("Mouse Update Message is Received"),CString("RTMPTest"),0);<br />
}<br />
else<br />
{<br />
MessageBox(NULL,CString("Peek UP Message But Not Update Messsage"),CString("RTMPTest"),0);<br />
}<br />
}<br />
Plz do helpful to me if you have any idea.
Thanks.
Ashish Bhatt
|
|
|
|
|
while (1)
{
// peek...
}
Add a Sleep(100) as a simple start...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Peter Weyzen wrote: Add a Sleep(100) as a simple start...
if any message come between that sleep(100) will be lost or delayed to processed by main application, as hook is working here
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
So, if you have any other suggetion then you can share it.
Ashish Bhatt
|
|
|
|
|
Thanks for reply.
i used sleep() before Peekmessage() and it works.But is there no any other way?.
And also I want to ask one question that is it right way to check current process cpu usage from task manager?? because I have heard that it is not perfact way.
Thanks.
Ashish Bhatt
|
|
|
|
|
Did you see my suggestion ? What about using GetMessage instead of PeekMessage ?
|
|
|
|
|
Use GetMessage instead of PeekMessage. This way, the GetMessage will block until a message is received in the queue. And you won't need to poll for messages (which consumes CPU cycles).
Also, you should check for the WM_QUIT message (and exit your infinite loop) otherwise your application will never terminate.
|
|
|
|
|
If you're on a dual-core machine -- this 50% is likely 100% for one processor -- which is bad!
Have you confirmed this in the debugger? If one of your threads is running at this rate, it should be easy to do a "break all" in the debugger and see what the threads are up to....
If you have a loop that's just going crazy -- you could just stick a sleep in there...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Hi All,
Can any one please tell me this. I have a MDI window, i am opening a child window on it where i am doing some gdi rendering after reading data from a file.
Just after reading data from a file and rendering it on the child screen, memory uasage in my task manager is ahowing 37K. Now I am minimizing the application and memory usage dorps to 2K. Now if i miximize the application it is occuping only 5K.
Can any one please give me some clue what might the reason.
With Thanks in advanced
Sandip
|
|
|
|
|
|
this is any solution for this
Sandip
|
|
|
|
|
Perhaps this article[^] can give you an explanation.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I always get y_num=0 when y_num=65536
How to get rid of this problem (variable type,...)
Please help.
#include<br />
#include<br />
#include<br />
#include<br />
#include<br />
<br />
typedef unsigned int WORD;<br />
typedef WORD* WORDPTR;<br />
<br />
WORDPTR *S;<br />
WORDPTR D;<br />
<br />
WORD x_num;<br />
WORD y_num;<br />
<br />
WORD a;<br />
WORD b;<br />
WORD i, j;<br />
int main()<br />
{<br />
puts("------------------ Start --------------------");<br />
puts("");<br />
<br />
a = 0;<br />
printf("Enter a = ");<br />
scanf("%u", &a);<br />
<br />
<br />
b = 0;<br />
printf("Enter b = ");<br />
scanf("%u", &b);<br />
<br />
x_num = 1 << a;<br />
y_num = 1 << b;<br />
<br />
S = (WORDPTR *)malloc(x_num*sizeof(WORDPTR));<br />
if (S == NULL)<br />
{<br />
puts("Error 1!");<br />
return 1;<br />
}<br />
for (i = 0; i < x_num; i++)<br />
{<br />
S[i] = (WORDPTR)malloc(y_num*sizeof(WORD));<br />
if (S[i] == NULL)<br />
{<br />
puts("Error 2!");<br />
return 1;<br />
}<br />
}<br />
<br />
D = (WORDPTR)malloc(y_num*sizeof(WORD));<br />
if (D == NULL)<br />
{<br />
puts("Error 3!");<br />
return 1;<br />
}<br />
puts("OK!");<br />
<br />
return (0);<br />
}
-- modified at 4:15 Wednesday 14th November, 2007
|
|
|
|
|
ndtoan13 wrote: I know 1 << 256 == 2^256 = 65536
2^16 == 65536
1 << 16 == 65536
|
|
|
|
|
ndtoan13 wrote: I know 1 << 256 == 2^256 = 65536
The above is not true, in fact:
1 << 256 = 2^256 = <big>HUGE number ( ~ 10^77 ) </big>
even an hypothetical 256-bit wide integer cannot hold this number.
So I suggest to revise you convinctions (BTW 65536 = 2^16 ).
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.
|
|
|
|
|
Sorry I am wrong. 65536 = 2^16
I need to print an array[256x65536]
Thanks.
|
|
|
|
|
I know 1 << 256 = 2^256 = HUGE number ( ~ 10^77 )
It is my wrong type after 18h coding.
I want a code to print an array [256x65536]
--> x_num=256 and y_num=65536
Event I assign static value like y_num=65536, y_num still = 0
What type of this variable need to solve this problem?
Please help.
|
|
|
|
|
You need a 32-bit wide integer. Usually int it is enough, however it is system-dependent, you can check the wideness of your datatype using the sizeof operator, you need:
sizeof(you_integer_datatype) >= 4
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.
|
|
|
|
|
I checked size of my datatype WORD: sizeof(WORD)=2
It is system-dependent! -> Which system can do that?
OR if it can be set, how to set it to 32bit
Thanks
|
|
|
|
|
I mean, What is your system (e.g. PC with Windows XP, and so on...)?
Anyway try to change
typedef unsigned int WORD;
into
typedef unsigned long WORD;
and check again the size.
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.
|
|
|
|
|
Thanks a lot for your help.
By default, I use TC++ to build this porgram. It fails
I try it with VC++6, it works now.
I tried typedef unsigned int WORD; on TC++, It does not work.
|
|
|
|
|
Hi can any one tell me how to create a Modal dialog box in CWinThread derived class
Here i can able to create an dialog box but it is acting as an Modeless dialogbox.
VimalKumar.T
|
|
|
|
|
Is this CWinThread a UI thread?
If not, you probably should post a message to one of your windows -- asking it to open the dialog. ???
Just a thought -- someone else will have an actual answer.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
vethathiri wrote: Here i can able to create an dialog box but it is acting as an Modeless dialogbox.
Just want to know how do you verify that it is acting as Modeless Dialog box, is debugger goes to next line after DoModal() call ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I can able to work on the background "mean's i can operate menu items in modal dialog box it cannot be operated"
|
|
|
|